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

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

・WindowInfoクラスをリファクタリング
・MdiInfoを単純配列からvectorに変更した。

File size: 3.9 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 &GetClassName() const
129 {
130 return className;
131 }
132 void SetClassName( const std::string &className )
133 {
134 this->className = className;
135 }
136
137 const std::string GetHandleName() const
138 {
139 return "h" + this->GetName();
140 }
141
142 const std::string GetCallbackName() const
143 {
144 return this->GetName() + "Proc";
145 }
146
147 const std::string &GetMenuIdName() const
148 {
149 return menuIdName;
150 }
151 void SetMenuIdName( const std::string &menuIdName )
152 {
153 this->menuIdName = menuIdName;
154 }
155 bool HasMenu() const
156 {
157 return !menuIdName.empty();
158 }
159
160 int GetBackgroundColor() const
161 {
162 return backgroundColor;
163 }
164 void SetBackgroundColor( int backgroundColor )
165 {
166 this->backgroundColor = backgroundColor;
167 }
168
169 const std::string &GetIconResourceName() const
170 {
171 return iconResourceName;
172 }
173 void SetIconResourceName( const std::string &iconResourceName )
174 {
175 this->iconResourceName = iconResourceName;
176 }
177 bool HasIcon() const
178 {
179 return !iconResourceName.empty();
180 }
181
182 WindowType::EnumType GetType() const
183 {
184 return type;
185 }
186 void SetType( WindowType::EnumType type )
187 {
188 this->type = type;
189 }
190 bool IsDefaultWindow() const
191 {
192 return ( type == WindowType::Default );
193 }
194 bool IsModalDlg() const
195 {
196 return ( type == WindowType::ModalDlg );
197 }
198 bool IsModelessDlg() const
199 {
200 return ( type == WindowType::ModelessDlg );
201 }
202
203 //ウィンドウデータ
204 LOGFONT LogFont;
205
206 //子ウィンドウ管理
207 ChildWindowInfos childWindowInfos;
208
209 //ツリー項目
210 HTREEITEM hTreeItem;
211
212private:
213 std::string className;
214 std::string handleName;
215 std::string menuIdName;
216 int backgroundColor;
217 std::string iconResourceName;
218 WindowType::EnumType type;
219};
220
221class WindowInfos
222 : public std::vector<WindowInfo *>
223{
224public:
225 WindowInfos()
226 {
227 }
228 ~WindowInfos()
229 {
230 }
231
232 void Clear()
233 {
234 WindowInfos &windowInfos = *this;
235 BOOST_FOREACH( WindowInfo *pWindowInfo, windowInfos )
236 {
237 delete pWindowInfo;
238 }
239 this->clear();
240 }
241 void Erase( int index )
242 {
243 WindowInfos::iterator it = this->begin();
244 int i = 0;
245 while( i < index )
246 {
247 i ++;
248 it ++;
249 }
250 this->erase( it );
251 }
252};
253
254
255}}
Note: See TracBrowser for help on using the repository browser.