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

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

WindowInfoクラスをリファクタリング

File size: 3.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;
107class WindowInfo
108 : public WindowInfoBase
109{
110public:
111 WindowInfo()
112 : WindowInfoBase()
113 , CallBackName( NULL )
114 {
115 }
116
117 const std::string &GetClassName() const
118 {
119 return className;
120 }
121 void SetClassName( const std::string &className )
122 {
123 this->className = className;
124 }
125
126 const std::string &GetHandleName() const
127 {
128 return handleName;
129 }
130 void SetHandleName( const std::string &handleName )
131 {
132 this->handleName = handleName;
133 }
134
135 const std::string &GetMenuIdName() const
136 {
137 return menuIdName;
138 }
139 void SetMenuIdName( const std::string &menuIdName )
140 {
141 this->menuIdName = menuIdName;
142 }
143 bool HasMenu() const
144 {
145 return !menuIdName.empty();
146 }
147
148 int GetBackgroundColor() const
149 {
150 return backgroundColor;
151 }
152 void SetBackgroundColor( int backgroundColor )
153 {
154 this->backgroundColor = backgroundColor;
155 }
156
157 const std::string &GetIconResourceName() const
158 {
159 return iconResourceName;
160 }
161 void SetIconResourceName( const std::string &iconResourceName )
162 {
163 this->iconResourceName = iconResourceName;
164 }
165 bool HasIcon() const
166 {
167 return !iconResourceName.empty();
168 }
169
170 //ウィンドウデータ
171 LOGFONT LogFont;
172 char *CallBackName;
173 long type;
174 char *filepath;
175
176 //子ウィンドウ管理
177 ChildWindowInfos childWindowInfos;
178
179 //ツリー項目
180 HTREEITEM hTreeItem;
181
182private:
183 std::string className;
184 std::string handleName;
185 std::string menuIdName;
186 int backgroundColor;
187 std::string iconResourceName;
188};
189
190class WindowInfos
191 : public std::vector<WindowInfo *>
192{
193public:
194 WindowInfos()
195 {
196 }
197 ~WindowInfos()
198 {
199 }
200
201 void Clear()
202 {
203 WindowInfos &windowInfos = *this;
204 BOOST_FOREACH( WindowInfo *pWindowInfo, windowInfos )
205 {
206 delete pWindowInfo;
207 }
208 this->clear();
209 }
210 void Erase( int index )
211 {
212 WindowInfos::iterator it = this->begin();
213 for( int i=0; i!=index ;i++, it++ )
214 {
215 delete *it;
216 }
217 this->erase( it );
218 }
219};
220
221
222}}
Note: See TracBrowser for help on using the repository browser.