Index: CtrlLib/Button.cpp =================================================================== --- CtrlLib/Button.cpp (revision 81) +++ CtrlLib/Button.cpp (working copy) @@ -161,6 +161,15 @@ CTRL_NORMAL; } +Size Pusher::GetStdSize() const +{ + Size s; + s = GetSmartTextSize(label, font); + s.cx = max(s.cx + StdHMargin * 2, StdButtonMinWidth); + s.cy = max(s.cy, StdButtonMinHeight); + return s; +} + Pusher::Pusher() { keypush = push = false; accesskey = 0; @@ -422,6 +431,18 @@ return *this; } +Size Button::GetStdSize() const +{ + Size s; + s = GetSmartTextSize(label, font); + Size isz = img.GetSize(); + s.cx += isz.cx; + s.cy = max(s.cy, isz.cy); + s.cx = max(s.cx + StdHMargin * 2, StdButtonMinWidth); + s.cy = max(s.cy, StdButtonMinHeight); + return s; +} + Button::Button() { style = NULL; type = NORMAL; Index: CtrlLib/CtrlLib.h =================================================================== --- CtrlLib/CtrlLib.h (revision 81) +++ CtrlLib/CtrlLib.h (working copy) @@ -18,6 +18,16 @@ #define IMAGEFILE #include +// default for GetStdSize() and layout managers +const int StdSpacing = 8; +const int StdHSpacing = StdSpacing; +const int StdVSpacing = StdSpacing; +const int StdMargin = StdSpacing; +const int StdHMargin = StdMargin; +const int StdVMargin = StdMargin; +const int StdButtonMinHeight = 24; +const int StdButtonMinWidth = 76; + class Bar; #include Index: CtrlLib/PushCtrl.h =================================================================== --- CtrlLib/PushCtrl.h (revision 81) +++ CtrlLib/PushCtrl.h (working copy) @@ -14,7 +14,8 @@ virtual bool HotKey(dword key); virtual dword GetAccessKeys() const; virtual void AssignAccessKeys(dword used); - + virtual Size GetStdSize() const; + private: bool push:1; bool keypush:1; @@ -65,7 +66,8 @@ virtual void GotFocus(); virtual void LostFocus(); virtual int OverPaint() const; - + virtual Size GetStdSize() const; + public: struct Style : ChStyle