diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-09-11 17:29:20 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-11-08 09:14:35 +0100 |
commit | 9c8eee81496485f040eede8a76d43613dc5b4d14 (patch) | |
tree | 82c78be048c8207494b08c15bed41857fb1e9fe7 | |
parent | 9825276cbc20e89cc0e715aed6c6f642a0296754 (diff) |
vcl: mark stock buttons and transfer this to NWF on drawing
Stock buttons like OK/Cancel/Help need sometimes to be drawn
differently than just another button. For this we need to mark
such push buttons as "stock" when building them from a glade file
and transfer this information down to the NWF backend when drawing
the widget.
Change-Id: I131657f026a731208db47f4c8220622c8aabb464
-rw-r--r-- | include/vcl/button.hxx | 11 | ||||
-rw-r--r-- | include/vcl/salnativewidgets.hxx | 13 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 3 |
4 files changed, 28 insertions, 5 deletions
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index 3a4159d35392..b2e8a6223db9 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -163,6 +163,16 @@ public: virtual bool set_property(const OString &rKey, const OUString &rValue) override; virtual void ShowFocus(const tools::Rectangle& rRect) override; + void setStock(bool bIsStock) + { + mbIsStock = bIsStock; + } + + bool isStock() + { + return mbIsStock; + } + protected: PushButtonDropdownStyle mnDDStyle; bool mbIsActive; @@ -198,6 +208,7 @@ private: SymbolType meSymbol; TriState meState; bool mbPressed; + bool mbIsStock; }; inline void PushButton::Check( bool bCheck ) diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx index 46ffc48f799b..0caa4b880fdf 100644 --- a/include/vcl/salnativewidgets.hxx +++ b/include/vcl/salnativewidgets.hxx @@ -455,13 +455,18 @@ class VCL_DLLPUBLIC PushButtonValue : public ImplControlValue { public: PushButtonValue() - : ImplControlValue( ControlType::Pushbutton, 0 ) - , mbBevelButton( false ), mbSingleLine( true ) {} + : ImplControlValue( ControlType::Pushbutton, 0 ) + , mbBevelButton(false) + , mbSingleLine(true) + , mbIsStock(false) + {} + virtual ~PushButtonValue() override; virtual PushButtonValue* clone() const override; - bool mbBevelButton:1; // only used on OSX - bool mbSingleLine:1; // only used on OSX + bool mbBevelButton:1; // only used on OSX + bool mbSingleLine:1; // only used on OSX + bool mbIsStock:1; }; diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index a4948e6c833a..c67569c6dfb3 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -627,6 +627,7 @@ void PushButton::ImplInitPushButtonData() mnDDStyle = PushButtonDropdownStyle::NONE; mbIsActive = false; mbPressed = false; + mbIsStock = false; } namespace @@ -1027,6 +1028,8 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext) if (bNativeOK) { PushButtonValue aControlValue; + aControlValue.mbIsStock = isStock(); + tools::Rectangle aCtrlRegion(aInRect); ControlState nState = ControlState::NONE; @@ -1672,7 +1675,8 @@ void PushButton::ShowFocus(const tools::Rectangle& rRect) { if (IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Focus)) { - ImplControlValue aControlValue; + PushButtonValue aControlValue; + aControlValue.mbIsStock = isStock(); tools::Rectangle aInRect(Point(), GetOutputSizePixel()); GetOutDev()->DrawNativeControl(ControlType::Pushbutton, ControlPart::Focus, aInRect, ControlState::FOCUSED, aControlValue, OUString()); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index c5cd39b18f8f..8af60681afb1 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -804,6 +804,9 @@ namespace xWindow = VclPtr<PushButton>::Create(pParent, nBits); xWindow->SetText(getStockText(sType)); } + PushButton* pPushButton = dynamic_cast<PushButton*>(xWindow.get()); + if (pPushButton) + pPushButton->setStock(true); } if (!xWindow) |