source: dev/trunk/ab5.0/abdev/abdev/include/ProjectManager/WindowManager.h@ 629

Last change on this file since 629 was 629, checked in by dai_9181, 16 years ago

MDIINFO構造体をリファクタリング。

File size: 4.4 KB
Line 
1#pragma once
2
3
4namespace ActiveBasic{ namespace PM{
5
6
7struct ImageReferenceType
8{
9 enum EnumType
10 {
11 File = 0,
12 Resource,
13 };
14};
15
16class ImageControlInfo
17{
18public:
19 ImageReferenceType::EnumType type;
20 std::string path;
21
22 bool IsFile() const
23 {
24 return ( type == ImageReferenceType::File );
25 }
26 bool IsResource() const
27 {
28 return ( type == ImageReferenceType::Resource );
29 }
30};
31
32class WindowInfoBase
33{
34public:
35 const std::string &GetName() const
36 {
37 return name;
38 }
39 void SetName( const std::string &name )
40 {
41 this->name = name;
42 }
43
44 const std::string &GetCaption() const
45 {
46 return caption;
47 }
48 void SetCaption( const std::string &caption )
49 {
50 this->caption = caption;
51 }
52
53 DWORD GetStyle() const
54 {
55 return style;
56 }
57 void SetStyle( DWORD style )
58 {
59 this->style = style;
60 }
61 void AddStyle( DWORD style )
62 {
63 this->style |= style;
64 }
65 void AndStyle( DWORD style )
66 {
67 this->style &= style;
68 }
69 void DeleteStyle( DWORD style )
70 {
71 this->style &= ~style;
72 }
73
74 DWORD GetExStyle() const
75 {
76 return exstyle;
77 }
78 void SetExStyle( DWORD exstyle )
79 {
80 this->exstyle = exstyle;
81 }
82 void AddExStyle( DWORD exstyle )
83 {
84 this->exstyle |= exstyle;
85 }
86
87private:
88 std::string name;
89 std::string caption;
90 DWORD style;
91 DWORD exstyle;
92
93public:
94 POINT pos;
95 SIZE size;
96};
97
98class ChildWindowInfo
99 : public WindowInfoBase
100{
101public:
102 int Control;
103
104 ImageControlInfo image;
105};
106typedef std::vector<ChildWindowInfo *> ChildWindowInfos;
107
108struct WindowType
109{
110 enum EnumType
111 {
112 Default = 0,
113 ModalDlg = 1,
114 ModelessDlg = 3,
115 };
116};
117
118class WindowInfo
119 : public WindowInfoBase
120{
121public:
122
123 const std::string GetSourceFileName() const
124 {
125 return this->GetName() + ".ab";
126 }
127
128 const std::string GetSourceFileNameForOldVer( const std::string &baseDir ) const
129 {
130 if( Jenga::Common::Path( baseDir + this->GetName() + ".ab" ).IsExistFile() )
131 {
132 return this->GetName() + ".ab";
133 }
134 if( Jenga::Common::Path( baseDir + this->GetName() + ".abp" ).IsExistFile() )
135 {
136 return this->GetName() + ".abp";
137 }
138 if( Jenga::Common::Path( baseDir + this->GetName() + ".sbp" ).IsExistFile() )
139 {
140 return this->GetName() + ".sbp";
141 }
142 return this->GetName() + ".ab";
143 }
144
145 const std::string &GetClassName() const
146 {
147 return className;
148 }
149 void SetClassName( const std::string &className )
150 {
151 this->className = className;
152 }
153
154 const std::string GetHandleName() const
155 {
156 return "h" + this->GetName();
157 }
158
159 const std::string GetCallbackName() const
160 {
161 return this->GetName() + "Proc";
162 }
163
164 const std::string &GetMenuIdName() const
165 {
166 return menuIdName;
167 }
168 void SetMenuIdName( const std::string &menuIdName )
169 {
170 this->menuIdName = menuIdName;
171 }
172 bool HasMenu() const
173 {
174 return !menuIdName.empty();
175 }
176
177 int GetBackgroundColor() const
178 {
179 return backgroundColor;
180 }
181 void SetBackgroundColor( int backgroundColor )
182 {
183 this->backgroundColor = backgroundColor;
184 }
185
186 const std::string &GetIconResourceName() const
187 {
188 return iconResourceName;
189 }
190 void SetIconResourceName( const std::string &iconResourceName )
191 {
192 this->iconResourceName = iconResourceName;
193 }
194 bool HasIcon() const
195 {
196 return !iconResourceName.empty();
197 }
198
199 WindowType::EnumType GetType() const
200 {
201 return type;
202 }
203 void SetType( WindowType::EnumType type )
204 {
205 this->type = type;
206 }
207 bool IsDefaultWindow() const
208 {
209 return ( type == WindowType::Default );
210 }
211 bool IsModalDlg() const
212 {
213 return ( type == WindowType::ModalDlg );
214 }
215 bool IsModelessDlg() const
216 {
217 return ( type == WindowType::ModelessDlg );
218 }
219
220 //ウィンドウデータ
221 LOGFONT LogFont;
222
223 //子ウィンドウ管理
224 ChildWindowInfos childWindowInfos;
225
226 //ツリー項目
227 HTREEITEM hTreeItem;
228
229private:
230 std::string className;
231 std::string handleName;
232 std::string menuIdName;
233 int backgroundColor;
234 std::string iconResourceName;
235 WindowType::EnumType type;
236};
237
238class WindowInfos
239 : public std::vector<WindowInfo *>
240{
241public:
242 WindowInfos()
243 {
244 }
245 ~WindowInfos()
246 {
247 }
248
249 void Clear()
250 {
251 WindowInfos &windowInfos = *this;
252 BOOST_FOREACH( WindowInfo *pWindowInfo, windowInfos )
253 {
254 delete pWindowInfo;
255 }
256 this->clear();
257 }
258 void Erase( int index )
259 {
260 WindowInfos::iterator it = this->begin();
261 int i = 0;
262 while( i < index )
263 {
264 i ++;
265 it ++;
266 }
267 this->erase( it );
268 }
269};
270
271
272}}
Note: See TracBrowser for help on using the repository browser.