]>
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__
28 #include "wx/window.h"
29 #include "wx/string.h"
31 #define WXCONTROLAREA_VERSION 1.0
33 // layout types for title bars of the tabs
34 // (are selected up by evaluating the available free space )
36 class twTabInfo
; // forward decl.
38 #define wxTITLE_IMG_AND_TEXT 0
39 #define wxTITLE_IMG_ONLY 1
40 #define wxTITLE_BORDER_ONLY 2
43 * class manages and decorates contained "tab"-windows.
44 * Draws decorations similar to those in "Project Workplace"
45 * of Microsoft Developer Studio 4.xx
48 class wxTabbedWindow
: public wxPanel
50 DECLARE_DYNAMIC_CLASS( wxTabbedWindow
)
54 friend class wxTabbedWindowSerializer
;
57 void HideInactiveTabs( bool andRepaint
);
59 // overrride,to provide different font for tab-labels
61 virtual wxFont
GetLabelingFont();
63 // FOR NOW:: scrollbars are actually related to wxPagedWindow
65 wxScrollBar
* mpTabScroll
;
66 wxScrollBar
* mpHorizScroll
;
67 wxScrollBar
* mpVertScroll
;
71 // public properties (invoke ReclaclLayout(true) to apply changes)
73 int mVertGap
; // default: 3
74 int mHorizGap
; // default: 5
75 int mTitleVertGap
; // default: 3
76 int mTitleHorizGap
; // default: 4
77 int mImageTextGap
; // default: 2
78 int mFirstTitleGap
; // default: 11
79 int mBorderOnlyWidth
; // default: 8
81 wxPen mWhitePen
; // default: RGB(255,255,255)
82 wxPen mGrayPen
; // default: RGB(192,192,192)
83 wxPen mDarkPen
; // default: RGB(128,128,128)
84 wxPen mBlackPen
; // default: RGB( 0, 0, 0)
90 // notifications (can be handled by derivatives)
92 virtual void OnTabAdded( twTabInfo
* WXUNUSED(pInfo
) ) {}
94 virtual void SizeTabs(int x
,int y
, int width
, int height
, bool repant
);
98 virtual ~wxTabbedWindow();
100 // tabs can be also added when the window is
101 // already displayed - "on the fly"
103 virtual void AddTab( wxWindow
* pContent
, // contained window
104 wxString tabText
, // tab label
105 wxString imageFileName
= _T(""), // if "", only text label is displayed
106 wxBitmapType imageType
= wxBITMAP_TYPE_BMP
);
108 // NOTE:: if this AddTab(..) overload is called, the
109 // image bitmap will not be serialized (if performed),
110 // use the above method instead, so that images could
111 // be restored using the given file names
113 virtual void AddTab( wxWindow
* pContent
,
115 wxBitmap
* pImage
= NULL
);
117 virtual void RemoveTab( int tabNo
);
121 virtual int GetTabCount();
122 virtual wxWindow
* GetTab( int tabNo
);
123 virtual wxWindow
* GetActiveTab();
124 virtual void SetActiveTab( int tabNo
);
126 void DrawShadedRect( int x
, int y
, int width
, int height
,
127 wxPen
& upperPen
, wxPen
& lowerPen
, wxDC
& dc
);
129 virtual void DrawDecorations( wxDC
& dc
);
131 // return -1, if non of the title bars was hitted,
132 // otherwise the index of the hitted tab title bar
134 virtual int HitTest( const wxPoint
& pos
);
136 // should be invoked to redisplay window with changed properties
138 virtual void RecalcLayout( bool andRepaint
= true );
142 void OnPaint( wxPaintEvent
& event
);
143 void OnSize ( wxSizeEvent
& event
);
145 void OnBkErase( wxEraseEvent
& event
);
146 void OnLButtonDown( wxMouseEvent
& event
);
148 DECLARE_EVENT_TABLE()
152 * class manages and decorates contained "sheets" (or pages).
153 * Draws decorations similar to those in "Output window"
154 * of Microsoft Developer Studio 4.xx
157 class wxPagedWindow
: public wxTabbedWindow
159 DECLARE_DYNAMIC_CLASS( wxPagedWindow
)
160 // the protected: public: changes prevents Warnings in gcc
162 bool mScrollEventInProgress
;
168 int mAdjustableTitleRowLen
; // setup by dragging mini-sash
169 // with the mosue pointer
171 // drag&drop state variables
175 wxCursor mResizeCursor
;
176 wxCursor mNormalCursor
;
177 int mOriginalTitleRowLen
;
182 int mTitleRowLen
; // actual title row length
183 int mNoVertScroll
; // No Vertical Scroll true/false
185 void DrawPaperBar( twTabInfo
& tab
, int x
, int y
,
186 wxBrush
& brush
, wxPen
& pen
, wxDC
& dc
);
188 int GetWholeTabRowLen();
190 // adjusts scorllbars to fit around tabs
192 virtual void OnTabAdded( twTabInfo
* pInfo
);
194 // sets smaller font for page-labels
196 virtual wxFont
GetLabelingFont();
205 // NOTE:: use public methods of the base class
206 // to add "pages" to this window
210 // below two methods should be called after
211 // the tabs were added (AddTab(..)). Set up
212 // these scrollbars to match the needs of the
213 // tabs added into this area
215 wxScrollBar
& GetVerticalScrollBar();
216 wxScrollBar
& GetHorizontalScrollBar();
218 virtual void DrawDecorations( wxDC
& dc
);
220 // return -1, if non of the title bars was hitted,
221 // otherwise the index of the hitted tab title bar
223 virtual int HitTest( const wxPoint
& pos
);
225 virtual void RecalcLayout( bool andRepaint
= true );
229 void OnPaint( wxPaintEvent
& event
);
230 void OnSize ( wxSizeEvent
& event
);
231 void OnLButtonDown( wxMouseEvent
& event
);
232 void OnLButtonUp ( wxMouseEvent
& event
);
233 void OnMouseMove ( wxMouseEvent
& event
);
234 void OnScroll ( wxScrollEvent
& event
);
236 DECLARE_EVENT_TABLE()
239 // helper structure of wxTabbedWindow
241 class twTabInfo
: public wxObject
243 DECLARE_DYNAMIC_CLASS( twTabInfo
)
250 int ImageToTxtGap( int prefGap
);
255 unsigned int HasText();
257 wxWindow
& GetContent();
266 // used for serialization