From ca6aa93fd448203a08b65b8b2c2db762f991d4d5 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 20 Oct 2012 12:57:22 +0100 Subject: add infrastructure for secondary button groups Change-Id: I5fd1bbc31a0259e92f6eb23beef5d3c77b74eed8 --- vcl/inc/vcl/window.hxx | 77 ++++++++++--------------------------------- vcl/inc/window.h | 3 +- vcl/source/window/builder.cxx | 4 +++ vcl/source/window/layout.cxx | 1 + vcl/source/window/window.cxx | 1 + vcl/source/window/window2.cxx | 13 ++++++++ 6 files changed, 38 insertions(+), 61 deletions(-) (limited to 'vcl') diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index 5b83760ee6cd..54a9ba9bf394 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -1119,67 +1119,41 @@ public: Size get_preferred_size() const; /* - * Gets the value of the "halign" property. + * How to horizontally align this widget */ VclAlign get_halign() const; - - /* - * Sets the horizontal alignment of widget. See the "halign" property. - */ void set_halign(VclAlign eAlign); /* - * Gets the value of the "valign" property. + * How to vertically align this widget */ VclAlign get_valign() const; - - /* - * Sets the horizontal alignment of widget. See the "valign" property. - */ void set_valign(VclAlign eAlign); /* - * Gets whether the widget would like to use any available extra horizontal + * Whether the widget would like to use any available extra horizontal * space. */ bool get_hexpand() const; - - /* - * Sets whether the widget would like to use any available extra horizontal - * space. - */ void set_hexpand(bool bExpand); /* - * Gets whether the widget would like to use any available extra vertical + * Whether the widget would like to use any available extra vertical * space. */ bool get_vexpand() const; - - /* - * Sets whether the widget would like to use any available extra vertical - * space. - */ void set_vexpand(bool bExpand); /* - * Gets whether the widget would like to use any available extra space. + * Whether the widget would like to use any available extra space. */ bool get_expand() const; - - /* - * Sets whether the widget would like to use any available extra space. - */ void set_expand(bool bExpand); /* - * Gets whether the widget should receive extra space when the parent grows + * Whether the widget should receive extra space when the parent grows */ bool get_fill() const; - - /* - * Sets whether the widget should receive extra space when the parent grows - */ void set_fill(bool bFill); void set_border_width(sal_Int32 nBorderWidth); @@ -1198,64 +1172,47 @@ public: sal_Int32 get_margin_bottom() const; /* - * Gets how the widget is packed with reference to the start or end of the parent + * How the widget is packed with reference to the start or end of the parent */ VclPackType get_pack_type() const; - - /* - * Sets how the widget is packed with reference to the start or end of the parent - */ void set_pack_type(VclPackType ePackType); /* - * Sets extra space to put between the widget and its neighbors + * The extra space to put between the widget and its neighbors */ sal_Int32 get_padding() const; - - /* - * Sets extra space to put between the widget and its neighbors - */ void set_padding(sal_Int32 nPadding); /* - * Gets the number of columns that the widget spans + * The number of columns that the widget spans */ sal_Int32 get_grid_width() const; - - /* - * Sets the number of columns that the widget spans - */ void set_grid_width(sal_Int32 nCols); /* - * Gets the column number to attach the left side of the widget to + * The column number to attach the left side of the widget to */ sal_Int32 get_grid_left_attach() const; - - /* - * Sets the column number to attach the left side of the widget to - */ void set_grid_left_attach(sal_Int32 nAttach); /* - * Gets the number of row that the widget spans + * The number of row that the widget spans */ sal_Int32 get_grid_height() const; - - /* - * Sets the number of row that the widget spans - */ void set_grid_height(sal_Int32 nRows); /* - * Gets the row number to attach the top side of the widget to + * The row number to attach the top side of the widget to */ sal_Int32 get_grid_top_attach() const; + void set_grid_top_attach(sal_Int32 nAttach); /* - * Sets the row number to attach the top side of the widget to + * If true this child appears in a secondary layout group of children + * e.g. help buttons in a buttonbox */ - void set_grid_top_attach(sal_Int32 nAttach); + bool get_secondary() const; + void set_secondary(bool bSecondary); /* * Sets a widget property diff --git a/vcl/inc/window.h b/vcl/inc/window.h index cb48d04118d8..7f16bba19ef1 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -403,7 +403,8 @@ public: mbHexpand:1, mbVexpand:1, mbExpand:1, - mbFill:1; + mbFill:1, + mbSecondary:1; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer; }; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 20a2b71de725..bf14656c50e8 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1460,6 +1460,10 @@ void VclBuilder::applyPackingProperty(Window *pCurrent, { set_window_packing_position(pCurrent, sValue.toInt32()); } + else if (sKey == "secondary") + { + pCurrent->set_secondary(toBool(sValue)); + } else { SAL_WARN("vcl.layout", "unknown packing: " << sKey.getStr()); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 8336a08055ed..e2a594b535aa 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -255,6 +255,7 @@ Size VclButtonBox::calculateRequisition() const { if (!pChild->IsVisible()) continue; + SAL_WARN_IF(pChild->get_secondary(), "vcl.layout", "secondary groups not implemented yet"); ++nVisibleChildren; Size aChildSize = getLayoutRequisition(*pChild); if (aChildSize.Width() > aSize.Width()) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 9efcedf9ac92..b154eab540a7 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -726,6 +726,7 @@ void Window::ImplInitWindowData( WindowType nType ) mpWindowImpl->mbVexpand = false; mpWindowImpl->mbExpand = false; mpWindowImpl->mbFill = true; + mpWindowImpl->mbSecondary = false; mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // sal_True: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 4c0b3309cc10..ba04bb6fc8f9 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1925,6 +1925,7 @@ void Window::take_properties(Window &rOther) mpWindowImpl->mbVexpand = pWindowImpl->mbVexpand; mpWindowImpl->mbExpand = pWindowImpl->mbExpand; mpWindowImpl->mbFill = pWindowImpl->mbFill; + mpWindowImpl->mbSecondary = pWindowImpl->mbSecondary; bool bHasBorderWindow = mpWindowImpl->mpBorderWindow; bool bOtherHasBorderWindow = pWindowImpl->mpBorderWindow; @@ -2321,4 +2322,16 @@ sal_Int32 Window::get_width_request() const return pWindowImpl->mnWidthRequest; } +bool Window::get_secondary() const +{ + WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl; + return pWindowImpl->mbSecondary; +} + +void Window::set_secondary(bool bSecondary) +{ + WindowImpl *pWindowImpl = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow->mpWindowImpl : mpWindowImpl; + pWindowImpl->mbSecondary = bSecondary; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit