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
RevLine 
[615]1#pragma once
2
3
[624]4namespace ActiveBasic{ namespace PM{
[615]5
[624]6
[615]7struct ImageReferenceType
8{
9 enum EnumType
10 {
11 File = 0,
12 Resource,
13 };
14};
15
[624]16class ImageControlInfo
[615]17{
[624]18public:
[615]19 ImageReferenceType::EnumType type;
20 std::string path;
[624]21
22 bool IsFile() const
23 {
24 return ( type == ImageReferenceType::File );
25 }
26 bool IsResource() const
27 {
28 return ( type == ImageReferenceType::Resource );
29 }
[615]30};
31
[624]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 }
[615]43
[624]44 const std::string &GetCaption() const
45 {
46 return caption;
47 }
48 void SetCaption( const std::string &caption )
49 {
50 this->caption = caption;
51 }
[615]52
[624]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 }
[615]73
[624]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;
[615]96};
97
[624]98class ChildWindowInfo
99 : public WindowInfoBase
[616]100{
101public:
[615]102 int Control;
103
[624]104 ImageControlInfo image;
[615]105};
[624]106typedef std::vector<ChildWindowInfo *> ChildWindowInfos;
[625]107
108struct WindowType
109{
110 enum EnumType
111 {
112 Default = 0,
113 ModalDlg = 1,
114 ModelessDlg = 3,
115 };
116};
117
[615]118class WindowInfo
[624]119 : public WindowInfoBase
[615]120{
121public:
[625]122
123 const std::string GetSourceFileName() const
[615]124 {
[625]125 return this->GetName() + ".ab";
[615]126 }
127
[624]128 const std::string &GetClassName() const
[617]129 {
[624]130 return className;
[617]131 }
[624]132 void SetClassName( const std::string &className )
[617]133 {
[624]134 this->className = className;
[617]135 }
136
[625]137 const std::string GetHandleName() const
[624]138 {
[625]139 return "h" + this->GetName();
[624]140 }
[625]141
142 const std::string GetCallbackName() const
[617]143 {
[625]144 return this->GetName() + "Proc";
[617]145 }
[624]146
147 const std::string &GetMenuIdName() const
[617]148 {
[624]149 return menuIdName;
[617]150 }
[624]151 void SetMenuIdName( const std::string &menuIdName )
152 {
153 this->menuIdName = menuIdName;
154 }
155 bool HasMenu() const
156 {
157 return !menuIdName.empty();
158 }
[617]159
[624]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
[625]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
[615]203 //ウィンドウデータ
204 LOGFONT LogFont;
205
206 //子ウィンドウ管理
[624]207 ChildWindowInfos childWindowInfos;
[615]208
209 //ツリー項目
210 HTREEITEM hTreeItem;
[617]211
212private:
[624]213 std::string className;
[617]214 std::string handleName;
[624]215 std::string menuIdName;
216 int backgroundColor;
217 std::string iconResourceName;
[625]218 WindowType::EnumType type;
[615]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();
[625]244 int i = 0;
245 while( i < index )
[615]246 {
[625]247 i ++;
248 it ++;
[615]249 }
250 this->erase( it );
251 }
252};
[624]253
254
255}}
Note: See TracBrowser for help on using the repository browser.