X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..d36c9347ea16171bc2f855076d8b9b11801ec622:/include/wx/gbsizer.h diff --git a/include/wx/gbsizer.h b/include/wx/gbsizer.h index 8b0934162d..6ceeb9311f 100644 --- a/include/wx/gbsizer.h +++ b/include/wx/gbsizer.h @@ -8,16 +8,12 @@ // Created: 03-Nov-2003 // RCS-ID: $Id$ // Copyright: (c) Robin Dunn -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WXGBSIZER_H__ #define __WXGBSIZER_H__ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "gbsizer.h" -#endif - #include "wx/sizer.h" @@ -27,7 +23,7 @@ // instead of wxPoint and wxSize because they are (x,y) and usually pixel // oriented while grids and tables are usually thought of as (row,col) so some // confusion would definitely result in using wxPoint... -// +// // NOTE: This should probably be refactored to a common RowCol data type which // is used for this and also for wxGridCellCoords. //--------------------------------------------------------------------------- @@ -44,7 +40,7 @@ public: int GetCol() const { return m_col; } void SetRow(int row) { m_row = row; } void SetCol(int col) { m_col = col; } - + bool operator==(const wxGBPosition& p) const { return m_row == p.m_row && m_col == p.m_col; } bool operator!=(const wxGBPosition& p) const { return !(*this == p); } @@ -66,7 +62,7 @@ public: int GetColspan() const { return m_colspan; } void SetRowspan(int rowspan) { m_rowspan = rowspan; } void SetColspan(int colspan) { m_colspan = colspan; } - + bool operator==(const wxGBSpan& o) const { return m_rowspan == o.m_rowspan && m_colspan == o.m_colspan; } bool operator!=(const wxGBSpan& o) const { return !(*this == o); } @@ -75,8 +71,8 @@ private: int m_colspan; }; - -WXDLLEXPORT_DATA(extern const wxGBSpan) wxDefaultSpan; + +extern WXDLLEXPORT_DATA(const wxGBSpan) wxDefaultSpan; //--------------------------------------------------------------------------- @@ -117,7 +113,7 @@ public: // default ctor wxGBSizerItem(); - + // Get the grid position of the item wxGBPosition GetPos() const { return m_pos; } void GetPos(int& row, int& col) const; @@ -147,20 +143,20 @@ public: // Get the row and column of the endpoint of this item void GetEndPos(int& row, int& col); - + wxGridBagSizer* GetGBSizer() const { return m_gbsizer; } void SetGBSizer(wxGridBagSizer* sizer) { m_gbsizer = sizer; } - - + + protected: wxGBPosition m_pos; wxGBSpan m_span; wxGridBagSizer* m_gbsizer; // so SetPos/SetSpan can check for intersects - -private: + +private: DECLARE_DYNAMIC_CLASS(wxGBSizerItem) - DECLARE_NO_COPY_CLASS(wxGBSizerItem) + DECLARE_NO_COPY_CLASS(wxGBSizerItem) }; @@ -176,26 +172,26 @@ public: // The Add methods return true if the item was successfully placed at the // given position, false if something was already there. - bool Add( wxWindow *window, - const wxGBPosition& pos, - const wxGBSpan& span = wxDefaultSpan, - int flag = 0, - int border = 0, - wxObject* userData = NULL ); - bool Add( wxSizer *sizer, - const wxGBPosition& pos, - const wxGBSpan& span = wxDefaultSpan, - int flag = 0, - int border = 0, - wxObject* userData = NULL ); - bool Add( int width, - int height, - const wxGBPosition& pos, - const wxGBSpan& span = wxDefaultSpan, - int flag = 0, - int border = 0, - wxObject* userData = NULL ); - bool Add( wxGBSizerItem *item ); + wxSizerItem* Add( wxWindow *window, + const wxGBPosition& pos, + const wxGBSpan& span = wxDefaultSpan, + int flag = 0, + int border = 0, + wxObject* userData = NULL ); + wxSizerItem* Add( wxSizer *sizer, + const wxGBPosition& pos, + const wxGBSpan& span = wxDefaultSpan, + int flag = 0, + int border = 0, + wxObject* userData = NULL ); + wxSizerItem* Add( int width, + int height, + const wxGBPosition& pos, + const wxGBSpan& span = wxDefaultSpan, + int flag = 0, + int border = 0, + wxObject* userData = NULL ); + wxSizerItem* Add( wxGBSizerItem *item ); // Get/Set the size used for cells in the grid with no item. @@ -205,7 +201,7 @@ public: // Get the size of the specified cell, including hgap and vgap. Only // valid after a Layout. wxSize GetCellSize(int row, int col) const; - + // Get the grid position of the specified item (non-recursive) wxGBPosition GetItemPosition(wxWindow *window); wxGBPosition GetItemPosition(wxSizer *sizer); @@ -229,31 +225,31 @@ public: bool SetItemSpan(wxWindow *window, const wxGBSpan& span); bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span); bool SetItemSpan(size_t index, const wxGBSpan& span); - + // Find the sizer item for the given window or subsizer, returns NULL if // not found. (non-recursive) wxGBSizerItem* FindItem(wxWindow* window); wxGBSizerItem* FindItem(wxSizer* sizer); - + // Return the sizer item for the given grid cell, or NULL if there is no // item at that position. (non-recursive) wxGBSizerItem* FindItemAtPosition(const wxGBPosition& pos); - + // Return the sizer item located at the point given in pt, or NULL if // there is no item at that point. The (x,y) coordinates in pt correspond // to the client coordinates of the window using the sizer for // layout. (non-recursive) wxGBSizerItem* FindItemAtPoint(const wxPoint& pt); - + // Return the sizer item that has a matching user data (it only compares // pointer values) or NULL if not found. (non-recursive) wxGBSizerItem* FindItemWithData(const wxObject* userData); - + // These are what make the sizer do size calculations and layout virtual void RecalcSizes(); virtual wxSize CalcMin(); @@ -266,38 +262,38 @@ public: bool CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL); bool CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL); - + // The Add base class virtuals should not be used with this class, but // we'll try to make them automatically select a location for the item // anyway. - virtual void Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Add( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Add( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Add( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); // The Insert and Prepend base class virtuals that are not appropriate for // this class and should not be used. Their implementation in this class // simply fails. - virtual void Add( wxSizerItem *item ); - virtual void Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Insert( size_t index, wxSizerItem *item ); - virtual void Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); - virtual void Prepend( wxSizerItem *item ); - - + virtual wxSizerItem* Add( wxSizerItem *item ); + virtual wxSizerItem* Insert( size_t index, wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Insert( size_t index, wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Insert( size_t index, int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Insert( size_t index, wxSizerItem *item ); + virtual wxSizerItem* Prepend( wxWindow *window, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Prepend( wxSizer *sizer, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Prepend( int width, int height, int proportion = 0, int flag = 0, int border = 0, wxObject* userData = NULL ); + virtual wxSizerItem* Prepend( wxSizerItem *item ); + + protected: wxGBPosition FindEmptyCell(); wxSize m_emptyCellSize; - - + + private: DECLARE_CLASS(wxGridBagSizer) - DECLARE_NO_COPY_CLASS(wxGridBagSizer) + DECLARE_NO_COPY_CLASS(wxGridBagSizer) }; //---------------------------------------------------------------------------