parent
b3c2abc8f3
commit
b033b0667e
@ -1,209 +0,0 @@
|
|||||||
From 42b3f8f57ad7cdb26fb8acb139c71ae1470a0b94 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
||||||
Date: Wed, 9 Jan 2019 09:48:07 +0000
|
|
||||||
Subject: [PATCH] Resolves: tdf#122467 drop down field name is too narrow
|
|
||||||
|
|
||||||
ellipise only when we have to
|
|
||||||
|
|
||||||
Change-Id: I79820dc84fc9ac0a755700c70bca9edbb14cf371
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/66001
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
|
|
||||||
---
|
|
||||||
dbaccess/uiconfig/ui/queryfilterdialog.ui | 20 ++++++++--------
|
|
||||||
vcl/unx/gtk3/gtk3gtkinst.cxx | 28 +++++++++++++++--------
|
|
||||||
2 files changed, 29 insertions(+), 19 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/dbaccess/uiconfig/ui/queryfilterdialog.ui b/dbaccess/uiconfig/ui/queryfilterdialog.ui
|
|
||||||
index a52ea3651ba3..46164e2f503d 100644
|
|
||||||
--- a/dbaccess/uiconfig/ui/queryfilterdialog.ui
|
|
||||||
+++ b/dbaccess/uiconfig/ui/queryfilterdialog.ui
|
|
||||||
@@ -99,7 +99,6 @@
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="label" translatable="yes" context="queryfilterdialog|label2">Operator</property>
|
|
||||||
- <property name="ellipsize">end</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
@@ -112,7 +111,6 @@
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="label" translatable="yes" context="queryfilterdialog|label5">Field name</property>
|
|
||||||
- <property name="ellipsize">end</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
@@ -124,7 +122,6 @@
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="label" translatable="yes" context="queryfilterdialog|label6">Condition</property>
|
|
||||||
- <property name="ellipsize">end</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">2</property>
|
|
||||||
@@ -135,7 +132,7 @@
|
|
||||||
<object class="GtkComboBoxText" id="field1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
- <property name="hexpand">True</property>
|
|
||||||
+ <property name="active">0</property>
|
|
||||||
<items>
|
|
||||||
<item translatable="yes" context="queryfilterdialog|field1">- none -</item>
|
|
||||||
</items>
|
|
||||||
@@ -150,6 +147,7 @@
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
+ <property name="active">0</property>
|
|
||||||
<items>
|
|
||||||
<item translatable="yes" context="queryfilterdialog|cond1">=</item>
|
|
||||||
<item translatable="yes" context="queryfilterdialog|cond1"><></item>
|
|
||||||
@@ -172,7 +170,7 @@
|
|
||||||
<object class="GtkComboBoxText" id="field2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
- <property name="hexpand">True</property>
|
|
||||||
+ <property name="active">0</property>
|
|
||||||
<items>
|
|
||||||
<item translatable="yes" context="queryfilterdialog|field2">- none -</item>
|
|
||||||
</items>
|
|
||||||
@@ -186,7 +184,7 @@
|
|
||||||
<object class="GtkComboBoxText" id="field3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
- <property name="hexpand">True</property>
|
|
||||||
+ <property name="active">0</property>
|
|
||||||
<items>
|
|
||||||
<item translatable="yes" context="queryfilterdialog|field3">- none -</item>
|
|
||||||
</items>
|
|
||||||
@@ -201,6 +199,7 @@
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
+ <property name="active">0</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">2</property>
|
|
||||||
@@ -212,6 +211,7 @@
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
+ <property name="active">0</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">2</property>
|
|
||||||
@@ -223,7 +223,6 @@
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="label" translatable="yes" context="queryfilterdialog|label7">Value</property>
|
|
||||||
- <property name="ellipsize">end</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">3</property>
|
|
||||||
@@ -234,6 +233,7 @@
|
|
||||||
<object class="GtkEntry" id="value1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
+ <property name="hexpand">True</property>
|
|
||||||
<property name="activates_default">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
@@ -245,6 +245,7 @@
|
|
||||||
<object class="GtkEntry" id="value2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
+ <property name="hexpand">True</property>
|
|
||||||
<property name="activates_default">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
@@ -256,6 +257,7 @@
|
|
||||||
<object class="GtkEntry" id="value3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
+ <property name="hexpand">True</property>
|
|
||||||
<property name="activates_default">True</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
@@ -267,7 +269,7 @@
|
|
||||||
<object class="GtkComboBoxText" id="op2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
- <property name="hexpand">True</property>
|
|
||||||
+ <property name="active">0</property>
|
|
||||||
<items>
|
|
||||||
<item translatable="yes" context="queryfilterdialog|op2">AND</item>
|
|
||||||
<item translatable="yes" context="queryfilterdialog|op2">OR</item>
|
|
||||||
@@ -282,7 +284,7 @@
|
|
||||||
<object class="GtkComboBoxText" id="op3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
- <property name="hexpand">True</property>
|
|
||||||
+ <property name="active">0</property>
|
|
||||||
<items>
|
|
||||||
<item translatable="yes" context="queryfilterdialog|op3">AND</item>
|
|
||||||
<item translatable="yes" context="queryfilterdialog|op3">OR</item>
|
|
||||||
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
index 0165b6888864..c440cd45189e 100644
|
|
||||||
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
@@ -6348,6 +6348,7 @@ class GtkInstanceComboBox : public GtkInstanceContainer, public vcl::ISearchable
|
|
||||||
private:
|
|
||||||
GtkComboBox* m_pComboBox;
|
|
||||||
GtkTreeModel* m_pTreeModel;
|
|
||||||
+ GtkCellRenderer* m_pTextRenderer;
|
|
||||||
GtkMenu* m_pMenu;
|
|
||||||
std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter;
|
|
||||||
vcl::QuickSelectionEngine m_aQuickSelectionEngine;
|
|
||||||
@@ -6660,23 +6661,19 @@ public:
|
|
||||||
if (!g_list_length(cells))
|
|
||||||
{
|
|
||||||
//Always use the same text column renderer layout
|
|
||||||
- GtkCellRenderer* text_renderer = gtk_cell_renderer_text_new();
|
|
||||||
- gtk_cell_layout_pack_end(GTK_CELL_LAYOUT(m_pComboBox), text_renderer, true);
|
|
||||||
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(m_pComboBox), text_renderer, "text", 0, nullptr);
|
|
||||||
- g_object_set(G_OBJECT(text_renderer), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr);
|
|
||||||
+ m_pTextRenderer = gtk_cell_renderer_text_new();
|
|
||||||
+ gtk_cell_layout_pack_end(GTK_CELL_LAYOUT(m_pComboBox), m_pTextRenderer, true);
|
|
||||||
+ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(m_pComboBox), m_pTextRenderer, "text", 0, nullptr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- // this bit isn't great, I really want to be able to ellipse the text in the comboboxtext itself and let
|
|
||||||
- // the popup menu render them in full, in the interim allow the text to wrap in both cases
|
|
||||||
- GtkCellRenderer* cell = static_cast<GtkCellRenderer*>(cells->data);
|
|
||||||
- g_object_set(G_OBJECT(cell), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr);
|
|
||||||
+ m_pTextRenderer = static_cast<GtkCellRenderer*>(cells->data);
|
|
||||||
if (g_list_length(cells) == 2)
|
|
||||||
{
|
|
||||||
//The ComboBox is always going to show the column associated with
|
|
||||||
//the entry when there is one, left to its own devices this image
|
|
||||||
//column will be after it, but we want it before
|
|
||||||
- gtk_cell_layout_reorder(GTK_CELL_LAYOUT(m_pComboBox), cell, 1);
|
|
||||||
+ gtk_cell_layout_reorder(GTK_CELL_LAYOUT(m_pComboBox), m_pTextRenderer, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_list_free(cells);
|
|
||||||
@@ -6723,7 +6720,18 @@ public:
|
|
||||||
GtkCellRenderer* cell = static_cast<GtkCellRenderer*>(cells->data);
|
|
||||||
GtkRequisition size;
|
|
||||||
gtk_cell_renderer_get_preferred_size(cell, m_pWidget, &size, nullptr);
|
|
||||||
- gtk_cell_renderer_set_fixed_size(cell, nWidth, size.height);
|
|
||||||
+ if (nWidth < size.width)
|
|
||||||
+ {
|
|
||||||
+ // this bit isn't great, I really want to be able to ellipse the text in the comboboxtext itself and let
|
|
||||||
+ // the popup menu render them in full, in the interim ellipse both
|
|
||||||
+ g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr);
|
|
||||||
+ gtk_cell_renderer_set_fixed_size(cell, nWidth, size.height);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_NONE, nullptr);
|
|
||||||
+ gtk_cell_renderer_set_fixed_size(cell, size.width, size.height);
|
|
||||||
+ }
|
|
||||||
g_list_free(cells);
|
|
||||||
|
|
||||||
gtk_widget_set_size_request(m_pWidget, nWidth, nHeight);
|
|
||||||
--
|
|
||||||
2.21.0.rc1
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
From 2e0f991f2eb57c0c25f32f759853195f9764a529 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
||||||
Date: Wed, 16 Jan 2019 12:36:25 +0000
|
|
||||||
Subject: [PATCH] Resolves: tdf#122623 theme unwanted tab into invisibility
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
its nigh impossible to have a GtkNotebook without an active tab, so
|
|
||||||
try and theme it into invisibility with no width
|
|
||||||
|
|
||||||
Change-Id: I312b81ae51abe9fdd222fb5d5c45cb41603b80cb
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/66471
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
|
|
||||||
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
|
|
||||||
Tested-by: Caolán McNamara <caolanm@redhat.com>
|
|
||||||
---
|
|
||||||
vcl/unx/gtk3/gtk3gtkinst.cxx | 12 +++++++++++-
|
|
||||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
index 4ea6de898734..83794ade2efd 100644
|
|
||||||
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
@@ -3153,7 +3153,7 @@ private:
|
|
||||||
{
|
|
||||||
disable_notify_events();
|
|
||||||
|
|
||||||
- GtkWidget *pTabWidget = gtk_image_new_from_icon_name("pan-down-symbolic", GTK_ICON_SIZE_BUTTON);
|
|
||||||
+ GtkWidget *pTabWidget = gtk_fixed_new();
|
|
||||||
gtk_buildable_set_name(GTK_BUILDABLE(pTabWidget), "useless");
|
|
||||||
|
|
||||||
GtkWidget *pChild = gtk_grid_new();
|
|
||||||
@@ -3383,6 +3383,16 @@ public:
|
|
||||||
else
|
|
||||||
m_nSizeAllocateSignalId = 0;
|
|
||||||
gtk_notebook_set_show_border(m_pOverFlowNotebook, false);
|
|
||||||
+
|
|
||||||
+ // tdf#122623 it's nigh impossible to have a GtkNotebook without an active (checked) tab, so try and theme
|
|
||||||
+ // the unwanted tab into invisibility
|
|
||||||
+ GtkStyleContext *pNotebookContext = gtk_widget_get_style_context(GTK_WIDGET(m_pOverFlowNotebook));
|
|
||||||
+ GtkCssProvider *pProvider = gtk_css_provider_new();
|
|
||||||
+ static const gchar data[] = "header.top > tabs > tab:checked { box-shadow: none; padding: 0 0 0 0; margin: 0 0 0 0; border-image: none; border-image-width: 0 0 0 0; background-image: none; background-color: transparent; border-radius: 0 0 0 0; border-width: 0 0 0 0; border-style: none; border-color: transparent; opacity: 0; min-height: 0; min-width: 0; }";
|
|
||||||
+ static const gchar olddata[] = "tab.top:active { box-shadow: none; padding: 0 0 0 0; margin: 0 0 0 0; border-image: none; border-image-width: 0 0 0 0; background-image: none; background-color: transparent; border-radius: 0 0 0 0; border-width: 0 0 0 0; border-style: none; border-color: transparent; opacity: 0; }";
|
|
||||||
+ gtk_css_provider_load_from_data(pProvider, gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr);
|
|
||||||
+ gtk_style_context_add_provider(pNotebookContext, GTK_STYLE_PROVIDER(pProvider),
|
|
||||||
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual int get_current_page() const override
|
|
||||||
--
|
|
||||||
2.21.0.rc1
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
|||||||
From c73a30d4574d0a8baeb3945190c93b952b2d4b17 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
||||||
Date: Thu, 21 Feb 2019 15:57:22 +0000
|
|
||||||
Subject: [PATCH] menu of currency combobox in format-cells is too narrow
|
|
||||||
|
|
||||||
we want the combobox to be narrower than it wants to be. To make that happen
|
|
||||||
we have only the option of shrinking the cell renderer of the combobox area.
|
|
||||||
And that is also used by the menu.
|
|
||||||
|
|
||||||
Setting a small value of e.g. 1 works to let the combobox not request more
|
|
||||||
width than that, and the combobox will correctly render within the wider size
|
|
||||||
it actually gets. But then the menu is a min width menu, which is undesirable,
|
|
||||||
we want the menu to be as wide as it can be.
|
|
||||||
|
|
||||||
So calculate what part of the combobox belongs to the cell area and set
|
|
||||||
the widest cell area we can within the overall combobox width, resulting
|
|
||||||
in the widest menu we can get.
|
|
||||||
|
|
||||||
Change-Id: Ie3e9960a320a70471ac21d2a88f32632cafa951f
|
|
||||||
---
|
|
||||||
vcl/unx/gtk3/gtk3gtkinst.cxx | 23 +++++++++++++++++------
|
|
||||||
1 file changed, 17 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
index 253698f..e71aec7 100644
|
|
||||||
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
@@ -6729,20 +6729,31 @@ public:
|
|
||||||
// tweak the cell render to get a narrower size to stick
|
|
||||||
GList* cells = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(m_pComboBox));
|
|
||||||
GtkCellRenderer* cell = static_cast<GtkCellRenderer*>(cells->data);
|
|
||||||
- GtkRequisition size;
|
|
||||||
- gtk_cell_renderer_get_preferred_size(cell, m_pWidget, &size, nullptr);
|
|
||||||
- if (nWidth < size.width)
|
|
||||||
+
|
|
||||||
+ if (nWidth != -1)
|
|
||||||
{
|
|
||||||
// this bit isn't great, I really want to be able to ellipse the text in the comboboxtext itself and let
|
|
||||||
- // the popup menu render them in full, in the interim ellipse both
|
|
||||||
+ // the popup menu render them in full, in the interim ellipse both of them
|
|
||||||
g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, nullptr);
|
|
||||||
- gtk_cell_renderer_set_fixed_size(cell, nWidth, size.height);
|
|
||||||
+
|
|
||||||
+ // to find out how much of the width of the combobox belongs to the cell, set
|
|
||||||
+ // the cell and widget to the min cell width and see what the difference is
|
|
||||||
+ int min;
|
|
||||||
+ gtk_cell_renderer_get_preferred_width(cell, m_pWidget, &min, nullptr);
|
|
||||||
+ gtk_cell_renderer_set_fixed_size(cell, min, -1);
|
|
||||||
+ gtk_widget_set_size_request(m_pWidget, min, -1);
|
|
||||||
+ int nNonCellWidth = get_preferred_size().Width() - min;
|
|
||||||
+
|
|
||||||
+ // now set the cell to the max width which it can be within the
|
|
||||||
+ // requested widget width
|
|
||||||
+ gtk_cell_renderer_set_fixed_size(cell, nWidth - nNonCellWidth, -1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_object_set(G_OBJECT(m_pTextRenderer), "ellipsize", PANGO_ELLIPSIZE_NONE, nullptr);
|
|
||||||
- gtk_cell_renderer_set_fixed_size(cell, size.width, size.height);
|
|
||||||
+ gtk_cell_renderer_set_fixed_size(cell, -1, -1);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
g_list_free(cells);
|
|
||||||
|
|
||||||
gtk_widget_set_size_request(m_pWidget, nWidth, nHeight);
|
|
||||||
--
|
|
||||||
2.20.1
|
|
||||||
|
|
@ -1,124 +0,0 @@
|
|||||||
From f929a7e9e854ede215a72d3d84ca74cae156e1aa Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
||||||
Date: Thu, 17 Jan 2019 12:28:55 +0000
|
|
||||||
Subject: [PATCH] tdf#122393 move to overflow row on using left/right at end of
|
|
||||||
other row
|
|
||||||
|
|
||||||
and on ctrl+page_up/ctrl+page_down
|
|
||||||
|
|
||||||
Change-Id: I3320abfb91655b7b4278886cc6fc4dceb637e4b1
|
|
||||||
Reviewed-on: https://gerrit.libreoffice.org/66527
|
|
||||||
Tested-by: Jenkins
|
|
||||||
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
|
|
||||||
---
|
|
||||||
vcl/unx/gtk3/gtk3gtkinst.cxx | 59 ++++++++++++++++++++++++++++++++++++
|
|
||||||
1 file changed, 59 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
index fe74ae76bdb3..08fc49de25e5 100644
|
|
||||||
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
|
|
||||||
@@ -3002,6 +3002,8 @@ private:
|
|
||||||
gulong m_nSwitchPageSignalId;
|
|
||||||
gulong m_nOverFlowSwitchPageSignalId;
|
|
||||||
gulong m_nSizeAllocateSignalId;
|
|
||||||
+ gulong m_nFocusSignalId;
|
|
||||||
+ gulong m_nChangeCurrentPageId;
|
|
||||||
guint m_nLaunchSplitTimeoutId;
|
|
||||||
bool m_bOverFlowBoxActive;
|
|
||||||
bool m_bOverFlowBoxIsStart;
|
|
||||||
@@ -3365,6 +3367,55 @@ private:
|
|
||||||
pThis->signal_notebook_size_allocate();
|
|
||||||
}
|
|
||||||
|
|
||||||
+ bool signal_focus(GtkDirectionType direction)
|
|
||||||
+ {
|
|
||||||
+ if (!m_bOverFlowBoxActive)
|
|
||||||
+ return false;
|
|
||||||
+
|
|
||||||
+ int nPage = gtk_notebook_get_current_page(m_pNotebook);
|
|
||||||
+ if (direction == GTK_DIR_LEFT && nPage == 0)
|
|
||||||
+ {
|
|
||||||
+ auto nOverFlowLen = gtk_notebook_get_n_pages(m_pOverFlowNotebook) - 1;
|
|
||||||
+ gtk_notebook_set_current_page(m_pOverFlowNotebook, nOverFlowLen - 1);
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ else if (direction == GTK_DIR_RIGHT && nPage == gtk_notebook_get_n_pages(m_pNotebook) - 1)
|
|
||||||
+ {
|
|
||||||
+ gtk_notebook_set_current_page(m_pOverFlowNotebook, 0);
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ static gboolean signalFocus(GtkNotebook* notebook, GtkDirectionType direction, gpointer widget)
|
|
||||||
+ {
|
|
||||||
+ // if the notebook widget itself has focus
|
|
||||||
+ if (gtk_widget_is_focus(GTK_WIDGET(notebook)))
|
|
||||||
+ {
|
|
||||||
+ GtkInstanceNotebook* pThis = static_cast<GtkInstanceNotebook*>(widget);
|
|
||||||
+ return pThis->signal_focus(direction);
|
|
||||||
+ }
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // ctrl + page_up/ page_down
|
|
||||||
+ bool signal_change_current_page(gint arg1)
|
|
||||||
+ {
|
|
||||||
+ bool bHandled = signal_focus(arg1 < 0 ? GTK_DIR_LEFT : GTK_DIR_RIGHT);
|
|
||||||
+ if (bHandled)
|
|
||||||
+ g_signal_stop_emission_by_name(m_pNotebook, "change-current-page");
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ static gboolean signalChangeCurrentPage(GtkNotebook*, gint arg1, gpointer widget)
|
|
||||||
+ {
|
|
||||||
+ if (arg1 == 0)
|
|
||||||
+ return true;
|
|
||||||
+ GtkInstanceNotebook* pThis = static_cast<GtkInstanceNotebook*>(widget);
|
|
||||||
+ return pThis->signal_change_current_page(arg1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
public:
|
|
||||||
GtkInstanceNotebook(GtkNotebook* pNotebook, bool bTakeOwnership)
|
|
||||||
: GtkInstanceContainer(GTK_CONTAINER(pNotebook), bTakeOwnership)
|
|
||||||
@@ -3373,6 +3424,8 @@ public:
|
|
||||||
, m_pOverFlowNotebook(GTK_NOTEBOOK(gtk_notebook_new()))
|
|
||||||
, m_nSwitchPageSignalId(g_signal_connect(pNotebook, "switch-page", G_CALLBACK(signalSwitchPage), this))
|
|
||||||
, m_nOverFlowSwitchPageSignalId(g_signal_connect(m_pOverFlowNotebook, "switch-page", G_CALLBACK(signalOverFlowSwitchPage), this))
|
|
||||||
+ , m_nFocusSignalId(g_signal_connect(pNotebook, "focus", G_CALLBACK(signalFocus), this))
|
|
||||||
+ , m_nChangeCurrentPageId(g_signal_connect(pNotebook, "change-current-page", G_CALLBACK(signalChangeCurrentPage), this))
|
|
||||||
, m_nLaunchSplitTimeoutId(0)
|
|
||||||
, m_bOverFlowBoxActive(false)
|
|
||||||
, m_bOverFlowBoxIsStart(false)
|
|
||||||
@@ -3508,6 +3561,8 @@ public:
|
|
||||||
virtual void disable_notify_events() override
|
|
||||||
{
|
|
||||||
g_signal_handler_block(m_pNotebook, m_nSwitchPageSignalId);
|
|
||||||
+ g_signal_handler_block(m_pNotebook, m_nFocusSignalId);
|
|
||||||
+ g_signal_handler_block(m_pNotebook, m_nChangeCurrentPageId);
|
|
||||||
g_signal_handler_block(m_pOverFlowNotebook, m_nOverFlowSwitchPageSignalId);
|
|
||||||
gtk_widget_freeze_child_notify(GTK_WIDGET(m_pOverFlowNotebook));
|
|
||||||
GtkInstanceContainer::disable_notify_events();
|
|
||||||
@@ -3519,6 +3574,8 @@ public:
|
|
||||||
gtk_widget_thaw_child_notify(GTK_WIDGET(m_pOverFlowNotebook));
|
|
||||||
g_signal_handler_unblock(m_pOverFlowNotebook, m_nOverFlowSwitchPageSignalId);
|
|
||||||
g_signal_handler_unblock(m_pNotebook, m_nSwitchPageSignalId);
|
|
||||||
+ g_signal_handler_unblock(m_pNotebook, m_nFocusSignalId);
|
|
||||||
+ g_signal_handler_unblock(m_pNotebook, m_nChangeCurrentPageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset_split_data()
|
|
||||||
@@ -3560,6 +3617,8 @@ public:
|
|
||||||
if (m_nSizeAllocateSignalId)
|
|
||||||
g_signal_handler_disconnect(m_pNotebook, m_nSizeAllocateSignalId);
|
|
||||||
g_signal_handler_disconnect(m_pNotebook, m_nSwitchPageSignalId);
|
|
||||||
+ g_signal_handler_disconnect(m_pNotebook, m_nFocusSignalId);
|
|
||||||
+ g_signal_handler_disconnect(m_pNotebook, m_nChangeCurrentPageId);
|
|
||||||
g_signal_handler_disconnect(m_pOverFlowNotebook, m_nOverFlowSwitchPageSignalId);
|
|
||||||
gtk_widget_destroy(GTK_WIDGET(m_pOverFlowNotebook));
|
|
||||||
if (m_pOverFlowBox)
|
|
||||||
--
|
|
||||||
2.21.0.rc1
|
|
||||||
|
|
Loading…
Reference in new issue