]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/fl/toolwnd.h
Compile fix.
[wxWidgets.git] / contrib / include / wx / fl / toolwnd.h
CommitLineData
8e08b761
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: No names yet.
3// Purpose: Contrib. demo
4// Author: Aleksandras Gluchovas
5// Modified by:
6// Created: 06/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Aleksandras Gluchovas
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __TOOLWND_G__
13#define __TOOLWND_G__
14
15#ifdef __GNUG__
16 #pragma interface "toolwnd.h"
17#endif
18
19#include "wx/frame.h"
20#include "wx/dynarray.h"
21
22// fixed settings
23
24#define BTN_BOX_HEIGHT 12
25#define BTN_BOX_WIDTH 12
26#define BTN_X_WIEGHT 2
27
28class cbMiniButton;
29
30typedef cbMiniButton* cbMinitButtonPtrT;
31
32WX_DEFINE_ARRAY( cbMinitButtonPtrT, cbMiniButtonArrayT );
33
34class wxToolWindow : public wxFrame
35{
36 DECLARE_DYNAMIC_CLASS( wxToolWindow )
37
38public: /** protected really, accessed only by serializers **/
39
40 cbMiniButtonArrayT mButtons;
41 wxWindow* mpClientWnd;
42
43 wxFont mTitleFont;
44
45 int mTitleHeight;
46 int mClntHorizGap;
47 int mClntVertGap;
48 int mWndVertGap;
49 int mWndHorizGap;
50 int mButtonGap;
51 int mInTitleMargin;
52 int mHintBorder;
53
54 bool mResizeStarted;
55 bool mRealTimeUpdatesOn;
56
57 int mMTolerance;
58
59 int mCursorType;
60 bool mMouseCaptured;
61
62 // drag&drop state variables
63
64 wxPoint mDragOrigin;
65 wxRect mInitialRect;
66 wxRect mPrevHintRect;
67 wxScreenDC* mpScrDc;
68
69protected:
70 void GetScrWindowRect( wxRect& r );
71 void GetScrMousePos ( wxMouseEvent& event, wxPoint& pos );
72 void SetHintCursor ( int type );
73
74 void CalcResizedRect( wxRect& rect, wxPoint& delta, const wxSize& minDim );
75 void AdjustRectPos( const wxRect& original, const wxSize& newDim, wxRect& newRect );
76 wxSize GetMinimalWndDim();
77
78 void DrawHintRect( const wxRect& r );
79
80 int HitTestWindow( wxMouseEvent& event );
81
82 void LayoutMiniButtons();
83
84public:
85
86 wxToolWindow();
87 ~wxToolWindow();
88
89 void SetClient( wxWindow* pWnd );
90 wxWindow* GetClient();
91
92 void SetTitleFont( wxFont& font );
93
94 // buttons are added in right-to-left order
95 void AddMiniButton( cbMiniButton* pBtn );
96
97 void OnPaint( wxPaintEvent& event );
98
99 void OnMotion( wxMouseEvent& event );
100 void OnLeftDown( wxMouseEvent& event );
101 void OnLeftUp( wxMouseEvent& event );
102 void OnSize( wxSizeEvent& event );
103
104 void OnEraseBackground( wxEraseEvent& event );
105
106 // overridables:
107
108 virtual wxSize GetPreferredSize( const wxSize& given );
109 virtual void OnMiniButtonClicked( int btnIdx ) {}
110 virtual bool HandleTitleClick( wxMouseEvent& event ) { return FALSE; }
111
112 DECLARE_EVENT_TABLE()
113};
114
115// FIXME:: the code below should be moved to a separate file
116
117#include "wx/fl/controlbar.h"
118
119class cbMiniButton : public wxObject
120{
121public:
122 wxPoint mPos;
123 wxSize mDim;
124 bool mVisible;
125 bool mEnabled;
126
127 wxFrameLayout* mpLayout;
128 cbDockPane* mpPane;
129 cbPluginBase* mpPlugin;
130
131 wxWindow* mpWnd;
132
133 bool mWasClicked;
134 bool mDragStarted;
135
136 bool mPressed;
137public:
138 cbMiniButton();
139
140 void SetPos( const wxPoint& pos );
141 bool HitTest( const wxPoint& pos );
142
143 void OnLeftDown( const wxPoint& pos );
144 void OnLeftUp( const wxPoint& pos );
145 void OnMotion( const wxPoint& pos );
146
147 void Refresh();
148 virtual void Draw( wxDC& dc );
149
150 bool WasClicked();
151 void Reset();
152
153 void Enable( bool enable ) { mEnabled = enable; }
154
155 bool IsPressed() { return mPressed; }
156};
157
158// classes specific to wxFrameLayout engine (FOR NOW in here...)
159
160class cbCloseBox : public cbMiniButton
161{
162public:
163 virtual void Draw( wxDC& dc );
164};
165
166class cbCollapseBox : public cbMiniButton
167{
168public:
169 bool mIsAtLeft;
170
171 virtual void Draw( wxDC& dc );
172};
173
174class cbDockBox : public cbMiniButton
175{
176public:
177 virtual void Draw( wxDC& dc );
178};
179
180class cbFloatedBarWindow : public wxToolWindow
181{
182 DECLARE_DYNAMIC_CLASS( cbFloatedBarWindow )
183protected:
184 cbBarInfo* mpBar;
185 wxFrameLayout* mpLayout;
186
187 friend class cbFloatedBarWindowSerializer;
188
189public:
190 cbFloatedBarWindow();
191
192 void SetBar( cbBarInfo* pBar );
193 void SetLayout( wxFrameLayout* pLayout );
194 cbBarInfo* GetBar();
195
196 // given coordinates are those of the bar itself
197 // floated container window's position and size
198 // are ajusted accordingly
199
200 void PositionFloatedWnd( int scrX, int scrY,
201 int width, int height );
202
203 // overriden methods of wxToolWindow
204
205 virtual wxSize GetPreferredSize( const wxSize& given );
206 virtual void OnMiniButtonClicked( int btnIdx );
207 virtual bool HandleTitleClick( wxMouseEvent& event );
208
209 void OnDblClick( wxMouseEvent& event );
210
211 DECLARE_EVENT_TABLE()
212};
213
214#endif /* __TOOLWND_G__ */
215
216