summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-05-13 16:57:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-05-21 09:53:46 +0200
commit8477bbf8d6867e656b8132f0ddd682d08590a547 (patch)
tree11d1f70190b6478bf3b070480393f364d58c81ab /svtools
parentc764b37489fb5f639c9e1c4faba64ebe405cc347 (diff)
weld ListBoxControl
Change-Id: I5a8c7d68e4c147eb938b0217dc6368c832e465c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94154 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/brwbox/ebbcontrols.cxx59
1 files changed, 17 insertions, 42 deletions
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index 65f333d09cf9..b60c71feaa92 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -33,6 +33,12 @@ namespace svt
{
}
+ void ComboBoxControl::dispose()
+ {
+ m_xWidget.reset();
+ InterimItemWindow::dispose();
+ }
+
//= ComboBoxCellController
ComboBoxCellController::ComboBoxCellController(ComboBoxControl* pWin)
:CellController(pWin)
@@ -98,51 +104,27 @@ namespace svt
//= ListBoxControl
ListBoxControl::ListBoxControl(vcl::Window* pParent)
- :ListBox(pParent, WB_DROPDOWN|WB_NOBORDER)
+ : InterimItemWindow(pParent, "svt/ui/listcontrol.ui", "ListControl")
+ , m_xWidget(m_xBuilder->weld_combo_box("listbox"))
{
- EnableAutoSize(false);
- EnableMultiSelection(false);
- SetDropDownLineCount(20);
}
- bool ListBoxControl::PreNotify( NotifyEvent& rNEvt )
+ void ListBoxControl::dispose()
{
- if (rNEvt.GetType() == MouseNotifyEvent::KEYINPUT && !IsInDropDown())
- {
- const KeyEvent *pEvt = rNEvt.GetKeyEvent();
- const vcl::KeyCode rKey = pEvt->GetKeyCode();
-
- if ((rKey.GetCode() == KEY_UP || rKey.GetCode() == KEY_DOWN) &&
- (!pEvt->GetKeyCode().IsShift() && pEvt->GetKeyCode().IsMod1()))
- {
- // select next resp. previous entry
- sal_Int32 nPos = GetSelectedEntryPos();
- int nDir = (rKey.GetCode() == KEY_DOWN ? 1 : -1);
- if (!((nPos == 0 && nDir == -1) || (nPos >= GetEntryCount() && nDir == 1)))
- {
- nPos += nDir;
- SelectEntryPos(nPos);
- }
- Select(); // for calling Modify
- return true;
- }
- else if (GetParent()->PreNotify(rNEvt))
- return true;
- }
- return ListBox::PreNotify(rNEvt);
+ m_xWidget.reset();
+ InterimItemWindow::dispose();
}
//= ListBoxCellController
ListBoxCellController::ListBoxCellController(ListBoxControl* pWin)
:CellController(pWin)
{
- GetListBox().SetSelectHdl(LINK(this, ListBoxCellController, ListBoxSelectHdl));
+ GetListBox().connect_changed(LINK(this, ListBoxCellController, ListBoxSelectHdl));
}
-
bool ListBoxCellController::MoveAllowed(const KeyEvent& rEvt) const
{
- const ListBoxControl& rBox = GetListBox();
+ const weld::ComboBox& rBox = GetListBox();
switch (rEvt.GetKeyCode().GetCode())
{
case KEY_UP:
@@ -157,7 +139,7 @@ namespace svt
[[fallthrough]];
case KEY_PAGEUP:
case KEY_PAGEDOWN:
- if (rBox.IsTravelSelect())
+ if (rBox.get_popup_shown())
return false;
[[fallthrough]];
default:
@@ -165,28 +147,22 @@ namespace svt
}
}
-
bool ListBoxCellController::IsModified() const
{
- return GetListBox().IsValueChangedFromSaved();
+ return GetListBox().get_value_changed_from_saved();
}
-
void ListBoxCellController::ClearModified()
{
- GetListBox().SaveValue();
+ GetListBox().save_value();
}
-
- IMPL_LINK_NOARG(ListBoxCellController, ListBoxSelectHdl, ListBox&, void)
+ IMPL_LINK_NOARG(ListBoxCellController, ListBoxSelectHdl, weld::ComboBox&, void)
{
callModifyHdl();
}
-
//= CheckBoxControl
-
-
CheckBoxControl::CheckBoxControl(vcl::Window* pParent)
:Control(pParent, 0)
{
@@ -210,7 +186,6 @@ namespace svt
pBox->Show();
}
-
CheckBoxControl::~CheckBoxControl()
{
disposeOnce();