]>
git.saurik.com Git - wxWidgets.git/blob - demos/dbbrowse/tabpgwin.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
5 // Modified by: 19990908 : mj
7 // - rename to tabpgwin
8 // - restruction of Variable declaration
9 // - to prevent Warnings under MingGW32
10 // Modified by: 19990909 : mj
11 // - mNoVertScroll true = no / false = Original Code
12 // the Original Code Paints a Vertical Scroll in wxPagedWindow
13 // which is not needed in this Version. Use true for this.
16 // Copyright: (c) Aleksandras Gluchovas
17 // Licence: wxWindows license
18 /////////////////////////////////////////////////////////////////////////////
20 #ifndef __TABPGWIN_G__
21 #define __TABPGWIN_G__
24 #include "wx/window.h"
25 #include "wx/string.h"
27 #define WXCONTROLAREA_VERSION 1.0
29 // layout types for title bars of the tabs
30 // (are selected up by evaluating the available free space )
32 class twTabInfo
; // forward decl.
34 #define wxTITLE_IMG_AND_TEXT 0
35 #define wxTITLE_IMG_ONLY 1
36 #define wxTITLE_BORDER_ONLY 2
39 * class manages and decorates contained "tab"-windows.
40 * Draws decorations similar to those in "Project Workplace"
41 * of Microsoft Developer Studio 4.xx
44 class wxTabbedWindow
: public wxPanel
46 DECLARE_DYNAMIC_CLASS( wxTabbedWindow
)
50 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 wxPagedWindow
61 wxScrollBar
* mpTabScroll
;
62 wxScrollBar
* mpHorizScroll
;
63 wxScrollBar
* mpVertScroll
;
67 // public properties (invoke ReclaclLayout(true) to apply changes)
69 int mVertGap
; // default: 3
70 int mHorizGap
; // default: 5
71 int mTitleVertGap
; // default: 3
72 int mTitleHorizGap
; // default: 4
73 int mImageTextGap
; // default: 2
74 int mFirstTitleGap
; // default: 11
75 int mBorderOnlyWidth
; // default: 8
77 wxPen mWhitePen
; // default: RGB(255,255,255)
78 wxPen mGrayPen
; // default: RGB(192,192,192)
79 wxPen mDarkPen
; // default: RGB(128,128,128)
80 wxPen mBlackPen
; // default: RGB( 0, 0, 0)
86 // notifications (can be handled by derivatives)
88 virtual void OnTabAdded( twTabInfo
* WXUNUSED(pInfo
) ) {}
90 virtual void SizeTabs(int x
,int y
, int width
, int height
, bool repant
);
94 virtual ~wxTabbedWindow();
96 // tabs can be also added when the window is
97 // already displayed - "on the fly"
99 virtual void AddTab( wxWindow
* pContent
, // contained window
100 wxString tabText
, // tab label
101 wxString imageFileName
= _T(""), // if "", only text label is displayed
102 wxBitmapType imageType
= wxBITMAP_TYPE_BMP
);
104 // NOTE:: if this AddTab(..) overload is called, the
105 // image bitmap will not be serialized (if performed),
106 // use the above method instead, so that images could
107 // be restored using the given file names
109 virtual void AddTab( wxWindow
* pContent
,
113 virtual void RemoveTab( int tabNo
);
117 virtual int GetTabCount();
118 virtual wxWindow
* GetTab( int tabNo
);
119 virtual wxWindow
* GetActiveTab();
120 virtual void SetActiveTab( int tabNo
);
122 void DrawShadedRect( int x
, int y
, int width
, int height
,
123 wxPen
& upperPen
, wxPen
& lowerPen
, wxDC
& dc
);
125 virtual void DrawDecorations( wxDC
& dc
);
127 // return -1, if non of the title bars was hitted,
128 // otherwise the index of the hitted tab title bar
130 virtual int HitTest( const wxPoint
& pos
);
132 // should be invoked to redisplay window with changed properties
134 virtual void RecalcLayout( bool andRepaint
= true );
138 void OnPaint( wxPaintEvent
& event
);
139 void OnSize ( wxSizeEvent
& event
);
141 void OnBkErase( wxEraseEvent
& event
);
142 void OnLButtonDown( wxMouseEvent
& event
);
144 DECLARE_EVENT_TABLE()
148 * class manages and decorates contained "sheets" (or pages).
149 * Draws decorations similar to those in "Output window"
150 * of Microsoft Developer Studio 4.xx
153 class wxPagedWindow
: public wxTabbedWindow
155 DECLARE_DYNAMIC_CLASS( wxPagedWindow
)
156 // the protected: public: changes prevents Warnings in gcc
158 bool mScrollEventInProgress
;
164 int mAdjustableTitleRowLen
; // setup by dragging mini-sash
165 // with the mosue pointer
167 // drag&drop state variables
171 wxCursor mResizeCursor
;
172 wxCursor mNormalCursor
;
173 int mOriginalTitleRowLen
;
178 int mTitleRowLen
; // actual title row length
179 int mNoVertScroll
; // No Vertical Scroll true/false
181 void DrawPaperBar( twTabInfo
& tab
, int x
, int y
,
182 wxBrush
& brush
, wxPen
& pen
, wxDC
& dc
);
184 int GetWholeTabRowLen();
186 // adjusts scorllbars to fit around tabs
188 virtual void OnTabAdded( twTabInfo
* pInfo
);
190 // sets smaller font for page-labels
192 virtual wxFont
GetLabelingFont();
201 // NOTE:: use public methods of the base class
202 // to add "pages" to this window
206 // below two methods should be called after
207 // the tabs were added (AddTab(..)). Set up
208 // these scrollbars to match the needs of the
209 // tabs added into this area
211 wxScrollBar
& GetVerticalScrollBar();
212 wxScrollBar
& GetHorizontalScrollBar();
214 virtual void DrawDecorations( wxDC
& dc
);
216 // return -1, if non of the title bars was hitted,
217 // otherwise the index of the hitted tab title bar
219 virtual int HitTest( const wxPoint
& pos
);
221 virtual void RecalcLayout( bool andRepaint
= true );
225 void OnPaint( wxPaintEvent
& event
);
226 void OnSize ( wxSizeEvent
& event
);
227 void OnLButtonDown( wxMouseEvent
& event
);
228 void OnLButtonUp ( wxMouseEvent
& event
);
229 void OnMouseMove ( wxMouseEvent
& event
);
230 void OnScroll ( wxScrollEvent
& event
);
232 DECLARE_EVENT_TABLE()
235 // helper structure of wxTabbedWindow
237 class twTabInfo
: public wxObject
239 DECLARE_DYNAMIC_CLASS( twTabInfo
)
246 int ImageToTxtGap( int prefGap
);
251 unsigned int HasText();
253 wxWindow
& GetContent();
262 // used for serialization