wxSizer patches by Alexander Smishlajev <als@turnhere.com>
Adds some wxALIGN_* flags to increase ability to position item within its allotted space. Adds wxSHAPED flag that enforces proportional resizing on growable items. Adds a sample and updated documentation. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,6 +56,15 @@ public:
|
||||
virtual wxSize CalcMin();
|
||||
virtual void SetDimension( wxPoint pos, wxSize size );
|
||||
|
||||
void SetRatio( int width, int height )
|
||||
// if either of dimensions is zero, ratio is assumed to be 1
|
||||
// to avoid "divide by zero" errors
|
||||
{ m_ratio = (width && height) ? ((float) width / (float) height) : 1; }
|
||||
void SetRatio( wxSize size )
|
||||
{ m_ratio = (size.x && size.y) ? ((float) size.x / (float) size.y) : 1; }
|
||||
void SetRatio( float ratio ) { m_ratio = ratio; }
|
||||
float GetRatio() const { return m_ratio; }
|
||||
|
||||
bool IsWindow();
|
||||
bool IsSizer();
|
||||
bool IsSpacer();
|
||||
@@ -81,6 +90,10 @@ protected:
|
||||
int m_option;
|
||||
int m_border;
|
||||
int m_flag;
|
||||
// als: aspect ratio can always be calculated from m_size,
|
||||
// but this would cause precision loss when the window
|
||||
// is shrinked. it is safer to preserve initial value.
|
||||
float m_ratio;
|
||||
wxObject *m_userData;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user