-
Notifications
You must be signed in to change notification settings - Fork 0
/
BCGPShapeBar.h
executable file
·233 lines (195 loc) · 6.34 KB
/
BCGPShapeBar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
//////////////////////////////////////////////////////////////////////
// Calques 3D - a 3D Dynamic Geometry Learning Environment
// Copyright (c) 1997-2007 Nicolas Van Labeke
//////////////////////////////////////////////////////////////////////
// This file is part of Calques 3D.
//
// Calques 3D is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Calques 3D is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Calques 3D; if not, write to The Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//////////////////////////////////////////////////////////////////////
/// @file BCGPShapeBar.h
/// @brief interface for the CBCGPShapeBar class
///
///
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BCGPSHAPEBAR_H__9B759C19_6B1C_48C4_A884_C0DEDD60DD77__INCLUDED_)
#define AFX_BCGPSHAPEBAR_H__9B759C19_6B1C_48C4_A884_C0DEDD60DD77__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif
class CBCGPShapeButton;
class CBCGPPropList;
/////////////////////////////////////////////////////////////////////////////
/// Provides the functionality of the regular docking control bar specially designed
/// to handle various shape selection issues in the document/application.
/////////////////////////////////////////////////////////////////////////////
class CBCGPShapeBar : public CBCGPPopupMenuBar
{
friend class CShapePopup;
friend class CBCGPShapeButton;
friend class CBCGPCShapeToolbarButton;
friend class CBCGPShapePopup;
DECLARE_SERIAL(CBCGPShapeBar)
// Construction
public:
CBCGPShapeBar();
virtual BOOL Create(
CWnd* pParentWnd,
DWORD dwStyle,
UINT nID,
CPalette* pPalette = NULL, // Palette color, NULL - standard 20 colors
int nColumns = 0, // Number of columns, -1 - default
int nRowsDockHorz = 0, // Number of rows for horz. docking
int nColDockVert = 0); // Number of columns for vert. docking
virtual BOOL CreateControl (
CWnd* pParentWnd,
const CRect& rect,
UINT nID,
int nColumns = -1,
CPalette* pPalette = NULL);
protected:
CBCGPShapeBar(
int type,
int nShape,
int nColumns,
int nRowsDockHorz,
int nColDockVert,
UINT nCommandID,
CBCGPShapeButton* pParentBtn);
CBCGPShapeBar (CBCGPShapeBar& src, UINT uiCommandID);
// Operations:
public:
void ContextToSize (BOOL bSquareButtons = TRUE,
BOOL bCenterButtons = TRUE);
// Attributes
public:
void SetShape (int shape);
int GetShape() const
{
return m_nShapeSelected;
}
UINT GetCommandID () const
{
return m_nCommandID;
}
void SetCommandID (UINT nCommandID)
{
m_nCommandID = nCommandID;
}
BOOL IsTearOff () const
{
return m_bIsTearOff;
}
void SetVertMargin (int nVertMargin);
void SetHorzMargin (int nHorzMargin);
int GetVertMargin () const
{
return m_nVertMargin;
}
int GetHorzMargin ()
{
return m_nHorzMargin;
}
protected:
int m_Type;
int m_nNumColumns;
int m_nNumRowsHorz;
int m_nNumColumnsVert;
int m_nShape;
CSize m_BoxSize;
int m_nRowHeight;
int m_nShapeSelected; // (-1) - auto
UINT m_nCommandID;
BOOL m_bIsEnabled;
BOOL m_bIsTearOff;
int m_nHorzOffset;
int m_nVertOffset;
BOOL m_bInternal; // Used in customization
int m_nVertMargin;
int m_nHorzMargin;
CBCGPShapeButton* m_pParentBtn;
//CBCGPPropList* m_pWndPropList;
// Overrides
virtual BOOL OnSendCommand (const CBCGPToolbarButton* pButton);
virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
virtual void AdjustLocations ();
virtual CSize CalcSize (BOOL bVertDock);
virtual void DoPaint(CDC* pDC);
virtual BOOL OnKey (UINT nChar);
virtual void Serialize (CArchive& ar);
virtual void ShowCommandMessageString (UINT uiCmdId);
virtual BOOL AllowChangeTextLabels () const
{
return FALSE;
}
virtual BOOL AllowShowOnList () const
{
return TRUE;
}
virtual void Rebuild ();
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBCGPShapeBar)
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CBCGPShapeBar();
// Generated message map functions
protected:
//{{AFX_MSG(CBCGPShapeBar)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
afx_msg void OnNcPaint();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnDestroy();
//}}AFX_MSG
afx_msg LRESULT OnMouseLeave(WPARAM,LPARAM);
DECLARE_MESSAGE_MAP()
CSize GetColorGridSize (BOOL bVertDock) const;
int GetExtraHeight (int nNumColumns) const;
};
/////////////////////////////////////////////////////////////////////////////
/// CBCGPCShapeToolbarButton
/////////////////////////////////////////////////////////////////////////////
class CBCGPCShapeToolbarButton : public CBCGPToolbarButton
{
friend class CBCGPShapeBar;
DECLARE_SERIAL(CBCGPCShapeToolbarButton)
protected:
CBCGPCShapeToolbarButton(int type=0,int index=0,
BOOL bIsAutomatic = FALSE,
LPCTSTR lpszColorName = NULL, BOOL bHighlight = FALSE);
// Overrides
virtual void OnDraw (CDC* pDC, const CRect& rect, CBCGPToolBarImages* pImages,
BOOL bHorz = TRUE, BOOL bCustomizeMode = FALSE,
BOOL bHighlight = FALSE,
BOOL bDrawBorder = TRUE,
BOOL bGrayDisabledButtons = TRUE);
virtual BOOL OnToolHitTest(const CWnd* pWnd, TOOLINFO* pTI);
virtual void OnChangeParentWnd (CWnd* pWndParent);
// Attributes
protected:
int m_Type;
int m_nShape;
BOOL m_bHighlight;
BOOL m_bIsAutomatic;
CBCGPShapeBar* m_pParentBar;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BCGPSHAPEBAR_H__9B759C19_6B1C_48C4_A884_C0DEDD60DD77__INCLUDED_)