]>
git.saurik.com Git - wxWidgets.git/blob - utils/framelayout/src/controlarea.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __CONTROLAREA_G__
13 #define __CONTROLAREA_G__
16 #pragma interface "controlarea.h"
20 #include "wx/window.h"
21 #include "wx/string.h"
23 #define WXCONTROLAREA_VERSION 1.0
25 // layout types for title bars of the tabs
26 // (are selected up by evaluating the available free space )
28 class twTabInfo
; // forward decl.
30 #define wxTITLE_IMG_AND_TEXT 0
31 #define wxTITLE_IMG_ONLY 1
32 #define wxTITLE_BORDER_ONLY 2
35 * class manages and decorates contained "tab"-windows.
36 * Draws decorations similar to those in "Project Workplace"
37 * of Microsoft Developer Studio 4.xx
40 class wxTabbedWindow
: public wxPanel
42 DECLARE_DYNAMIC_CLASS( wxTabbedWindow
)
46 friend class wxTabbedWindowSerializer
;
53 void HideInactiveTabs( bool andRepaint
);
55 // overrride,to provide different font for tab-labels
57 virtual wxFont
GetLabelingFont();
59 // FOR NOW:: scrollbars are actually related to wxPaggedWindow
61 wxScrollBar
* mpTabScroll
;
62 wxScrollBar
* mpHorizScroll
;
63 wxScrollBar
* mpVertScroll
;
67 // public properties (invoke ReclaclLayout(TRUE) to apply changes)
69 wxPen mWhitePen
; // default: RGB(255,255,255)
70 wxPen mGrayPen
; // default: RGB(192,192,192)
71 wxPen mDarkPen
; // default: RGB(128,128,128)
72 wxPen mBlackPen
; // default: RGB( 0, 0, 0)
74 int mVertGap
; // default: 3
75 int mHorizGap
; // default: 5
76 int mTitleVertGap
; // default: 3
77 int mTitleHorizGap
; // default: 4
78 int mImageTextGap
; // default: 2
79 int mFirstTitleGap
; // default: 11
80 int mBorderOnlyWidth
; // default: 8
82 // notifications (can be handled by derivatives)
84 virtual void OnTabAdded( twTabInfo
* pInfo
) {}
86 virtual void SizeTabs(int x
,int y
, int width
, int height
, bool repant
);
90 virtual ~wxTabbedWindow();
92 // tabs can be also added when the window is
93 // already displayed - "on the fly"
95 virtual void AddTab( wxWindow
* pContent
, // contained window
96 wxString tabText
, // tab label
97 wxString imageFileName
= "", // if "", only text label is displayed
98 long imageType
= wxBITMAP_TYPE_BMP
);
100 // NOTE:: if this AddTab(..) overload is called, the
101 // image bitmap will not be serialized (if performed),
102 // use the above method instead, so that images could
103 // be restored using the given file names
105 virtual void AddTab( wxWindow
* pContent
,
107 wxBitmap
* pImage
= NULL
);
110 virtual void RemoveTab( int tabNo
);
114 virtual int GetTabCount();
115 virtual wxWindow
* GetTab( int tabNo
);
116 virtual wxWindow
* GetActiveTab();
117 virtual void SetActiveTab( int tabNo
);
119 void DrawShadedRect( int x
, int y
, int width
, int height
,
120 wxPen
& upperPen
, wxPen
& lowerPen
, wxDC
& dc
);
122 virtual void DrawDecorations( wxDC
& dc
);
124 // return -1, if non of the title bars was hitted,
125 // otherwise the index of the hitted tab title bar
127 virtual int HitTest( const wxPoint
& pos
);
129 // should be invoked to redisplay window with changed properties
131 virtual void RecalcLayout( bool andRepaint
= TRUE
);
135 void OnPaint( wxPaintEvent
& event
);
136 void OnSize ( wxSizeEvent
& event
);
138 void OnBkErase( wxEraseEvent
& event
);
139 void OnLButtonDown( wxMouseEvent
& event
);
141 DECLARE_EVENT_TABLE()
145 * class manages and decorates contained "sheets" (or pages).
146 * Draws decorations similar to those in "Output window"
147 * of Microsoft Developer Studio 4.xx
150 class wxPaggedWindow
: public wxTabbedWindow
152 DECLARE_DYNAMIC_CLASS( wxPaggedWindow
)
155 bool mScrollEventInProgress
;
157 // drag&drop state variables
161 wxCursor mResizeCursor
;
162 wxCursor mNormalCursor
;
164 int mOriginalTitleRowLen
;
166 void DrawPaperBar( twTabInfo
& tab
, int x
, int y
,
167 wxBrush
& brush
, wxPen
& pen
, wxDC
& dc
);
169 int GetWholeTabRowLen();
171 // adjusts scorllbars to fit around tabs
173 virtual void OnTabAdded( twTabInfo
* pInfo
);
175 // sets smaller font for page-labels
177 virtual wxFont
GetLabelingFont();
183 int mTitleRowLen
; // actual title row length
184 int mAdjustableTitleRowLen
; // setup by dragging mini-sash
185 // with the mosue pointer
195 // NOTE:: use public methods of the base class
196 // to add "pages" to this window
200 // below two methods should be called after
201 // the tabs were added (AddTab(..)). Set up
202 // these scrollbars to match the needs of the
203 // tabs added into this area
205 wxScrollBar
& GetVerticalScrollBar();
206 wxScrollBar
& GetHorizontalScrollBar();
208 virtual void DrawDecorations( wxDC
& dc
);
210 // return -1, if non of the title bars was hitted,
211 // otherwise the index of the hitted tab title bar
213 virtual int HitTest( const wxPoint
& pos
);
215 virtual void RecalcLayout( bool andRepaint
= TRUE
);
219 void OnPaint( wxPaintEvent
& event
);
220 void OnSize ( wxSizeEvent
& event
);
221 void OnLButtonDown( wxMouseEvent
& event
);
222 void OnLButtonUp ( wxMouseEvent
& event
);
223 void OnMouseMove ( wxMouseEvent
& event
);
224 void OnScroll ( wxScrollEvent
& event
);
226 DECLARE_EVENT_TABLE()
229 // helper structure of wxTabbedWindow
231 class twTabInfo
: public wxObject
233 DECLARE_DYNAMIC_CLASS( twTabInfo
)
240 int ImageToTxtGap( int prefGap
);
246 wxWindow
& GetContent();
255 // used for serialization