hookup MenuButton::SetDropDown to GtkMenuButton draw-indicator

Change-Id: I556d61256bed8f607eed5a9c6e0ed3fcfd63af2c
Reviewed-on: https://gerrit.libreoffice.org/68802
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
2019-03-06 11:42:08 +00:00
parent ec26772e2e
commit 930e252db3
25 changed files with 64 additions and 4 deletions

View File

@@ -262,6 +262,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -291,6 +292,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -644,6 +646,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -135,6 +135,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -258,6 +259,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -273,6 +275,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -469,6 +469,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -499,6 +500,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -291,6 +291,7 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -328,6 +329,7 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -236,6 +236,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -747,6 +748,7 @@
<property name="receives_default">True</property>
<property name="popup">menuSELECT</property>
<property name="use_popover">False</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -364,6 +364,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popup">bitmapmenu</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -379,6 +380,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -232,6 +232,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -276,6 +277,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -124,6 +124,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -252,6 +252,7 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -264,6 +265,7 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -389,6 +391,7 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>

View File

@@ -155,6 +155,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -246,6 +247,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -246,6 +246,7 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="headerfootercontent|buttonBTN_FILE|tooltip_text">Title</property>
<property name="image">imageBTN_FILE</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>

View File

@@ -279,6 +279,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -452,6 +452,7 @@
<property name="receives_default">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -468,6 +469,7 @@
<property name="receives_default">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -258,6 +258,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -242,6 +242,7 @@
<property name="no_show_all">True</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -288,6 +289,7 @@
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="popup">menu</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -316,6 +318,7 @@
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="popup">menu1</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -344,6 +347,7 @@
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="popup">menu2</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -372,6 +376,7 @@
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="popup">menu3</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -401,6 +406,7 @@
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="popup">menu4</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -87,6 +87,7 @@
<property name="use_underline">True</property>
<property name="popup">menu1</property>
<property name="use_popover">False</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -163,6 +163,7 @@
<property name="use_underline">True</property>
<property name="popup">menu</property>
<property name="use_popover">False</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -449,6 +449,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -502,6 +503,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -230,6 +230,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popup">editmenu1</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -427,6 +428,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popup">editmenu2</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -302,6 +302,7 @@
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>
@@ -319,6 +320,7 @@
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -118,6 +118,7 @@
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<property name="popup">form</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -495,6 +495,7 @@
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -971,6 +971,7 @@
<property name="use_underline">True</property>
<property name="popup">filemenu</property>
<property name="use_popover">False</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -202,6 +202,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<child>
<placeholder/>
</child>

View File

@@ -1209,13 +1209,13 @@ namespace
return xWindow;
}
VclPtr<Button> extractStockAndBuildMenuButton(vcl::Window *pParent, VclBuilder::stringmap &rMap)
VclPtr<MenuButton> extractStockAndBuildMenuButton(vcl::Window *pParent, VclBuilder::stringmap &rMap)
{
WinBits nBits = WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER|WB_3DLOOK;
nBits |= extractRelief(rMap);
VclPtr<Button> xWindow = VclPtr<MenuButton>::Create(pParent, nBits);
VclPtr<MenuButton> xWindow = VclPtr<MenuButton>::Create(pParent, nBits);
if (extractStock(rMap))
{
@@ -1431,6 +1431,18 @@ namespace
}
return sAdjustment;
}
bool extractDrawIndicator(VclBuilder::stringmap &rMap)
{
bool bDrawIndicator = false;
VclBuilder::stringmap::iterator aFind = rMap.find(OString("draw-indicator"));
if (aFind != rMap.end())
{
bDrawIndicator = toBool(aFind->second);
rMap.erase(aFind);
}
return bDrawIndicator;
}
}
void VclBuilder::extractModel(const OString &id, stringmap &rMap)
@@ -1708,13 +1720,16 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
}
else if (name == "GtkMenuButton")
{
VclPtr<Button> xButton;
xButton = extractStockAndBuildMenuButton(pParent, rMap);
VclPtr<MenuButton> xButton = extractStockAndBuildMenuButton(pParent, rMap);
OUString sMenu = extractPopupMenu(rMap);
if (!sMenu.isEmpty())
m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu);
xButton->SetImageAlign(ImageAlign::Left); //default to left
xButton->SetAccessibleRole(css::accessibility::AccessibleRole::BUTTON_MENU);
if (!extractDrawIndicator(rMap))
xButton->SetDropDown(PushButtonDropdownStyle::NONE);
setupFromActionName(xButton, rMap, m_xFrame);
xWindow = xButton;
}