diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-04 14:53:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-04 22:12:46 +0200 |
commit | 0920b04bca3d58d89b026bcf999ea43d0e855715 (patch) | |
tree | e819560b7822cda8cd76a0494a4ec6135f3585a9 /vcl/unx/gtk3 | |
parent | 2cab4acbe2aaaee6e5b9afeb68f3e555ecff2ec7 (diff) |
weld SwOutlineTabDialog
Change-Id: I55c0e9a62dd9dd970a87ef295bb5fbb82c80d2d8
Reviewed-on: https://gerrit.libreoffice.org/53848
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 174 |
1 files changed, 103 insertions, 71 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 845e15ad15e4..d881155c7d40 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1449,6 +1449,75 @@ public: } }; +namespace +{ + OString MapToGtkAccelerator(const OUString &rStr) + { + return OUStringToOString(rStr.replaceFirst("~", "_"), RTL_TEXTENCODING_UTF8); + } + + OUString get_label(GtkLabel* pLabel) + { + const gchar* pStr = gtk_label_get_label(pLabel); + return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); + } + + void set_label(GtkLabel* pLabel, const OUString& rText) + { + gtk_label_set_label(pLabel, MapToGtkAccelerator(rText).getStr()); + } + + OUString get_label(GtkButton* pButton) + { + const gchar* pStr = gtk_button_get_label(pButton); + return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); + } + + void set_label(GtkButton* pButton, const OUString& rText) + { + gtk_button_set_label(pButton, MapToGtkAccelerator(rText).getStr()); + } + + OUString get_title(GtkWindow* pWindow) + { + const gchar* pStr = gtk_window_get_title(pWindow); + return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); + } + + void set_title(GtkWindow* pWindow, const OUString& rTitle) + { + gtk_window_set_title(pWindow, OUStringToOString(rTitle, RTL_TEXTENCODING_UTF8).getStr()); + } + + OUString get_primary_text(GtkMessageDialog* pMessageDialog) + { + gchar* pText = nullptr; + g_object_get(G_OBJECT(pMessageDialog), "text", &pText, nullptr); + return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); + } + + void set_primary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) + { + g_object_set(G_OBJECT(pMessageDialog), "text", + OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), + nullptr); + } + + void set_secondary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) + { + g_object_set(G_OBJECT(pMessageDialog), "secondary-text", + OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), + nullptr); + } + + OUString get_secondary_text(GtkMessageDialog* pMessageDialog) + { + gchar* pText = nullptr; + g_object_get(G_OBJECT(pMessageDialog), "secondary-text", &pText, nullptr); + return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); + } +} + class MenuHelper { protected: @@ -1519,6 +1588,21 @@ public: enable_item_notify_events(); } + void set_item_label(const OString& rIdent, const OUString& rText) + { + gtk_menu_item_set_label(m_aMap[rIdent], MapToGtkAccelerator(rText).getStr()); + } + + void set_item_help_id(const OString& rIdent, const OString& rHelpId) + { + set_help_id(GTK_WIDGET(m_aMap[rIdent]), rHelpId); + } + + OString get_item_help_id(const OString& rIdent) const + { + return get_help_id(GTK_WIDGET(m_aMap.find(rIdent)->second)); + } + void show_item(const OString& rIdent, bool bShow) { GtkWidget* pWidget = GTK_WIDGET(m_aMap[rIdent]); @@ -1666,75 +1750,6 @@ weld::Container* GtkInstanceWidget::weld_parent() const return pParent ? new GtkInstanceContainer(GTK_CONTAINER(pParent), false) : nullptr; } -namespace -{ - OString MapToGtkAccelerator(const OUString &rStr) - { - return OUStringToOString(rStr.replaceFirst("~", "_"), RTL_TEXTENCODING_UTF8); - } - - OUString get_label(GtkLabel* pLabel) - { - const gchar* pStr = gtk_label_get_label(pLabel); - return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); - } - - void set_label(GtkLabel* pLabel, const OUString& rText) - { - gtk_label_set_label(pLabel, MapToGtkAccelerator(rText).getStr()); - } - - OUString get_label(GtkButton* pButton) - { - const gchar* pStr = gtk_button_get_label(pButton); - return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); - } - - void set_label(GtkButton* pButton, const OUString& rText) - { - gtk_button_set_label(pButton, MapToGtkAccelerator(rText).getStr()); - } - - OUString get_title(GtkWindow* pWindow) - { - const gchar* pStr = gtk_window_get_title(pWindow); - return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); - } - - void set_title(GtkWindow* pWindow, const OUString& rTitle) - { - gtk_window_set_title(pWindow, OUStringToOString(rTitle, RTL_TEXTENCODING_UTF8).getStr()); - } - - OUString get_primary_text(GtkMessageDialog* pMessageDialog) - { - gchar* pText = nullptr; - g_object_get(G_OBJECT(pMessageDialog), "text", &pText, nullptr); - return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); - } - - void set_primary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) - { - g_object_set(G_OBJECT(pMessageDialog), "text", - OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), - nullptr); - } - - void set_secondary_text(GtkMessageDialog* pMessageDialog, const OUString& rText) - { - g_object_set(G_OBJECT(pMessageDialog), "secondary-text", - OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(), - nullptr); - } - - OUString get_secondary_text(GtkMessageDialog* pMessageDialog) - { - gchar* pText = nullptr; - g_object_get(G_OBJECT(pMessageDialog), "secondary-text", &pText, nullptr); - return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); - } -} - class GtkInstanceWindow : public GtkInstanceContainer, public virtual weld::Window { private: @@ -2578,9 +2593,24 @@ public: { } - virtual void set_active(const OString& rIdent, bool bActive) override + virtual void set_item_active(const OString& rIdent, bool bActive) override { - set_item_active(rIdent, bActive); + MenuHelper::set_item_active(rIdent, bActive); + } + + virtual void set_item_label(const OString& rIdent, const OUString& rLabel) override + { + MenuHelper::set_item_label(rIdent, rLabel); + } + + virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) override + { + MenuHelper::set_item_help_id(rIdent, rHelpId); + } + + virtual OString get_item_help_id(const OString& rIdent) const override + { + return MenuHelper::get_item_help_id(rIdent); } virtual void signal_activate(GtkMenuItem* pItem) override @@ -3211,7 +3241,9 @@ public: virtual void set_selection_mode(bool bMultiple) override { + disable_notify_events(); gtk_tree_selection_set_mode(gtk_tree_view_get_selection(m_pTreeView), bMultiple ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE); + enable_notify_events(); } virtual int count_selected_rows() const override |