File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,11 @@ bool GUIButton::IsClippingImage() const
154154 return (_flags & kGUICtrl_Clip ) != 0 ;
155155}
156156
157+ bool GUIButton::HasAction () const
158+ {
159+ return _clickAction[kGUIClickLeft ] != kGUIAction_None || _clickAction[kGUIClickRight ] != kGUIAction_None ;
160+ }
161+
157162GUIClickAction GUIButton::GetClickAction (GUIClickMouseButton button) const
158163{
159164 if (button < kGUIClickLeft || button >= kNumGUIClicks )
@@ -255,7 +260,12 @@ Rect GUIButton::CalcGraphicRect(bool clipped)
255260
256261void GUIButton::Draw (Bitmap *ds, int x, int y)
257262{
258- const bool draw_disabled = GUI::ShouldDrawDisabled (this );
263+ // A non-clickable button is, in effect, just a label.
264+ // When the GUI is disabled, the user should not get the message that
265+ // the button is now unclickable since it had never been in the first place.
266+ bool const has_interaction = IsClickable () || HasAction ();
267+ const bool draw_disabled = GUI::ShouldDrawDisabled (this )
268+ && has_interaction;
259269 // TODO: should only change properties in reaction to particular events
260270 if (_currentImage <= 0 || draw_disabled)
261271 _currentImage = _image;
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ class GUIButton : public GUIObject
9393 const String &GetText () const ;
9494 bool IsImageButton () const ;
9595 bool IsClippingImage () const ;
96+ bool HasAction () const ;
9697
9798 GUIClickAction GetClickAction (GUIClickMouseButton button) const ;
9899 int GetClickData (GUIClickMouseButton button) const ;
You can’t perform that action at this time.
0 commit comments