]>
git.saurik.com Git - wxWidgets.git/blob - utils/framelayout/src/controlarea.h
15cb9386af41ff1ebdc529af29096eadf8435ad9
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 mLightPen
; // wxSYS_COLOUR_3DHIGHLIGHT
71 wxPen mGrayPen
; // wxSYS_COLOUR_3DFACE
72 wxPen mDarkPen
; // wxSYS_COLOUR_3DSHADOW
73 wxPen mBlackPen
; // default: RGB( 0, 0, 0)
75 int mVertGap
; // default: 3
76 int mHorizGap
; // default: 5
77 int mTitleVertGap
; // default: 3
78 int mTitleHorizGap
; // default: 4
79 int mImageTextGap
; // default: 2
80 int mFirstTitleGap
; // default: 11
81 int mBorderOnlyWidth
; // default: 8
83 // notifications (can be handled by derivatives)
85 virtual void OnTabAdded( twTabInfo
* pInfo
) {}
87 virtual void SizeTabs(int x
,int y
, int width
, int height
, bool repant
);
91 virtual ~wxTabbedWindow();
93 // tabs can be also added when the window is
94 // already displayed - "on the fly"
96 virtual void AddTab( wxWindow
* pContent
, // contained window
97 wxString tabText
, // tab label
98 wxString imageFileName
= "", // if "", only text label is displayed
99 long imageType
= wxBITMAP_TYPE_BMP
);
101 // NOTE:: if this AddTab(..) overload is called, the
102 // image bitmap will not be serialized (if performed),
103 // use the above method instead, so that images could
104 // be restored using the given file names
106 virtual void AddTab( wxWindow
* pContent
,
108 wxBitmap
* pImage
= NULL
);
111 virtual void RemoveTab( int tabNo
);
115 virtual int GetTabCount();
116 virtual wxWindow
* GetTab( int tabNo
);
117 virtual wxWindow
* GetActiveTab();
118 virtual void SetActiveTab( int tabNo
);
120 void DrawShadedRect( int x
, int y
, int width
, int height
,
121 wxPen
& upperPen
, wxPen
& lowerPen
, wxDC
& dc
);
123 virtual void DrawDecorations( wxDC
& dc
);
125 // return -1, if non of the title bars was hitted,
126 // otherwise the index of the hitted tab title bar
128 virtual int HitTest( const wxPoint
& pos
);
130 // should be invoked to redisplay window with changed properties
132 virtual void RecalcLayout( bool andRepaint
= TRUE
);
136 void OnPaint( wxPaintEvent
& event
);
137 void OnSize ( wxSizeEvent
& event
);
139 void OnBkErase( wxEraseEvent
& event
);
140 void OnLButtonDown( wxMouseEvent
& event
);
142 DECLARE_EVENT_TABLE()
146 * class manages and decorates contained "sheets" (or pages).
147 * Draws decorations similar to those in "Output window"
148 * of Microsoft Developer Studio 4.xx
151 class wxPaggedWindow
: public wxTabbedWindow
153 DECLARE_DYNAMIC_CLASS( wxPaggedWindow
)
156 bool mScrollEventInProgress
;
158 // drag&drop state variables
162 wxCursor mResizeCursor
;
163 wxCursor mNormalCursor
;
165 int mOriginalTitleRowLen
;
167 void DrawPaperBar( twTabInfo
& tab
, int x
, int y
,
168 wxBrush
& brush
, wxPen
& pen
, wxDC
& dc
);
170 int GetWholeTabRowLen();
172 // adjusts scorllbars to fit around tabs
174 virtual void OnTabAdded( twTabInfo
* pInfo
);
176 // sets smaller font for page-labels
178 virtual wxFont
GetLabelingFont();
184 int mTitleRowLen
; // actual title row length
185 int mAdjustableTitleRowLen
; // setup by dragging mini-sash
186 // with the mosue pointer
196 // NOTE:: use public methods of the base class
197 // to add "pages" to this window
201 // below two methods should be called after
202 // the tabs were added (AddTab(..)). Set up
203 // these scrollbars to match the needs of the
204 // tabs added into this area
206 wxScrollBar
& GetVerticalScrollBar();
207 wxScrollBar
& GetHorizontalScrollBar();
209 virtual void DrawDecorations( wxDC
& dc
);
211 // return -1, if non of the title bars was hitted,
212 // otherwise the index of the hitted tab title bar
214 virtual int HitTest( const wxPoint
& pos
);
216 virtual void RecalcLayout( bool andRepaint
= TRUE
);
220 void OnPaint( wxPaintEvent
& event
);
221 void OnSize ( wxSizeEvent
& event
);
222 void OnLButtonDown( wxMouseEvent
& event
);
223 void OnLButtonUp ( wxMouseEvent
& event
);
224 void OnMouseMove ( wxMouseEvent
& event
);
225 void OnScroll ( wxScrollEvent
& event
);
227 DECLARE_EVENT_TABLE()
230 // helper structure of wxTabbedWindow
232 class twTabInfo
: public wxObject
234 DECLARE_DYNAMIC_CLASS( twTabInfo
)
241 int ImageToTxtGap( int prefGap
);
247 wxWindow
& GetContent();
256 // used for serialization