move freeze/thaw to Widget

Change-Id: I3944092c26ca81028912f6fb206b148b49e4f172
Reviewed-on: https://gerrit.libreoffice.org/57489
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2018-07-16 10:26:19 +01:00
parent 140d9b8326
commit 5cc423efe3
3 changed files with 27 additions and 30 deletions

View File

@ -103,6 +103,9 @@ public:
virtual bool get_direction() const = 0;
virtual void set_direction(bool bRTL) = 0;
virtual void freeze() = 0;
virtual void thaw() = 0;
virtual Container* weld_parent() const = 0;
virtual ~Widget() {}
@ -277,9 +280,6 @@ public:
virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) = 0;
virtual void set_entry_completion(bool bEnable) = 0;
virtual void freeze() = 0;
virtual void thaw() = 0;
void connect_entry_activate(const Link<ComboBoxText&, void>& rLink)
{
m_aEntryActivateHdl = rLink;
@ -313,9 +313,6 @@ public:
virtual void clear() = 0;
virtual int get_height_rows(int nRows) const = 0;
virtual void freeze() = 0;
virtual void thaw() = 0;
virtual void set_selection_mode(bool bMultiple) = 0;
virtual int count_selected_rows() const = 0;

View File

@ -393,6 +393,16 @@ public:
m_xWidget->EnableRTL(bRTL);
}
virtual void freeze() override
{
m_xWidget->SetUpdateMode(false);
}
virtual void thaw() override
{
m_xWidget->SetUpdateMode(true);
}
virtual weld::Container* weld_parent() const override;
virtual ~SalInstanceWidget() override
@ -1583,16 +1593,6 @@ public:
return nRet;
}
virtual void freeze() override
{
m_xTreeView->SetUpdateMode(false);
}
virtual void thaw() override
{
m_xTreeView->SetUpdateMode(true);
}
virtual void set_selection_mode(bool bMultiple) override
{
m_xTreeView->EnableMultiSelection(bMultiple);
@ -2117,16 +2117,6 @@ public:
m_xComboBoxText->SetStyle(m_xComboBoxText->GetStyle() | WB_SORT);
}
virtual void freeze() override
{
m_xComboBoxText->SetUpdateMode(false);
}
virtual void thaw() override
{
m_xComboBoxText->SetUpdateMode(true);
}
virtual ~SalInstanceComboBoxText() override
{
clear();

View File

@ -1462,6 +1462,16 @@ public:
gtk_widget_set_direction(m_pWidget, bRTL ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
}
virtual void freeze() override
{
gtk_widget_freeze_child_notify(m_pWidget);
}
virtual void thaw() override
{
gtk_widget_thaw_child_notify(m_pWidget);
}
virtual ~GtkInstanceWidget() override
{
if (m_nFocusInSignalId)
@ -3742,7 +3752,7 @@ public:
{
disable_notify_events();
g_object_ref(m_pListStore);
gtk_widget_freeze_child_notify(GTK_WIDGET(m_pTreeView));
GtkInstanceContainer::freeze();
gtk_tree_view_set_model(m_pTreeView, nullptr);
enable_notify_events();
}
@ -3751,7 +3761,7 @@ public:
{
disable_notify_events();
gtk_tree_view_set_model(m_pTreeView, GTK_TREE_MODEL(m_pListStore));
gtk_widget_thaw_child_notify(GTK_WIDGET(m_pTreeView));
GtkInstanceContainer::thaw();
g_object_unref(m_pListStore);
enable_notify_events();
}
@ -4759,7 +4769,7 @@ public:
virtual void freeze() override
{
gtk_widget_freeze_child_notify(GTK_WIDGET(m_pComboBoxText));
GtkInstanceContainer::freeze();
if (m_xSorter)
{
GtkTreeModel* pModel = gtk_combo_box_get_model(GTK_COMBO_BOX(m_pComboBoxText));
@ -4776,7 +4786,7 @@ public:
GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(pModel);
gtk_tree_sortable_set_sort_column_id(pSortable, 0, GTK_SORT_ASCENDING);
}
gtk_widget_thaw_child_notify(GTK_WIDGET(m_pComboBoxText));
GtkInstanceContainer::thaw();
}
virtual ~GtkInstanceComboBoxText() override