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
This commit is contained in:
parent
dc75cdaf5e
commit
137bb94052
4 changed files with 28 additions and 5 deletions
|
@ -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;
|
||||
|
@ -199,6 +209,7 @@ private:
|
|||
SymbolType meSymbol;
|
||||
TriState meState;
|
||||
bool mbPressed;
|
||||
bool mbIsStock;
|
||||
};
|
||||
|
||||
inline void PushButton::Check( bool bCheck )
|
||||
|
|
|
@ -494,8 +494,12 @@ 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;
|
||||
|
||||
|
@ -504,8 +508,9 @@ public:
|
|||
PushButtonValue & operator =(PushButtonValue const &) = delete; // due to ImplControlValue
|
||||
PushButtonValue & operator =(PushButtonValue &&) = delete; // due to ImplControlValue
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -634,6 +634,7 @@ void PushButton::ImplInitPushButtonData()
|
|||
mnDDStyle = PushButtonDropdownStyle::NONE;
|
||||
mbIsActive = false;
|
||||
mbPressed = false;
|
||||
mbIsStock = false;
|
||||
}
|
||||
|
||||
namespace
|
||||
|
@ -1044,6 +1045,8 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
|
|||
if (bNativeOK)
|
||||
{
|
||||
PushButtonValue aControlValue;
|
||||
aControlValue.mbIsStock = isStock();
|
||||
|
||||
tools::Rectangle aCtrlRegion(aInRect);
|
||||
ControlState nState = ControlState::NONE;
|
||||
|
||||
|
@ -1697,7 +1700,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());
|
||||
|
|
|
@ -1128,6 +1128,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)
|
||||
|
|
Loading…
Reference in a new issue