00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _WIN_BASE_H_
00027 #define _WIN_BASE_H_
00028
00029 #include "win_event.h"
00030 #include "win_border.h"
00031 #include "win_background.h"
00032 #include "win_keys.h"
00033
00034 class win_container;
00035 class win_scroll;
00036 class win_select;
00037 class win_manager;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 class win_base: public win_event, public win_border, public drawing_area, public win_background
00048 {
00049 public:
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 win_base();
00063
00064
00065
00066
00067
00068 s_int16 x() const
00069 {return x_;}
00070
00071
00072
00073
00074
00075
00076 s_int16 y() const
00077 {return y_;}
00078
00079
00080
00081
00082
00083
00084 s_int16 & pad_x()
00085 {return pad_x_;}
00086
00087
00088
00089
00090
00091
00092 s_int16 & pad_y()
00093 {return pad_y_;}
00094
00095
00096
00097
00098
00099
00100 s_int16 real_x() const
00101 {return drawing_area::x();}
00102
00103
00104
00105
00106
00107
00108 s_int16 real_y() const
00109 {return drawing_area::y();}
00110
00111
00112
00113
00114
00115
00116 virtual void move(s_int16 tx,s_int16 ty);
00117
00118
00119
00120
00121
00122
00123 virtual void resize(u_int16 tl, u_int16 th);
00124
00125
00126
00127
00128
00129 bool is_visible() const
00130 {return visible_;}
00131
00132
00133
00134
00135
00136 void set_visible(const bool b)
00137 {visible_=b;}
00138
00139
00140
00141
00142
00143 bool is_activate() const
00144 {return activate_;}
00145
00146
00147
00148
00149
00150
00151
00152 void set_activate(const bool b)
00153 {if((activate_=b)) {on_activate();input::clear_keys_queue();}else on_unactivate();}
00154
00155
00156
00157
00158
00159 bool is_focus()const
00160 {return focus_;}
00161
00162
00163
00164
00165
00166 void set_focus(const bool b)
00167 {focus_=b;}
00168
00169
00170
00171
00172
00173 bool is_trans() const
00174 {return trans_;}
00175
00176
00177
00178
00179
00180 virtual void set_trans(const bool b)
00181 {set_trans_border(trans_ = b);set_trans_background(b);}
00182
00183
00184
00185
00186
00187 bool is_brightness() const
00188 {return brightness_;}
00189
00190
00191
00192
00193
00194 virtual void set_brightness(const bool b)
00195 {set_brightness_border(brightness_ = b);set_brightness_background(b);}
00196
00197
00198
00199
00200
00201 void set_align(const u_int8 a)
00202 {align_=a;update_align();}
00203
00204
00205
00206
00207
00208 u_int8 align() const {return align_;}
00209
00210
00211
00212
00213
00214 bool is_can_be_selected() const
00215 {return can_be_selected_;}
00216
00217
00218
00219
00220
00221
00222 void set_can_be_selected(const bool b)
00223 {can_be_selected_ = b;}
00224
00225
00226
00227
00228
00229 virtual bool update();
00230
00231
00232
00233
00234
00235 virtual bool draw();
00236
00237
00238
00239
00240
00241 virtual bool input_update();
00242
00243 virtual ~win_base();
00244
00245 void set_manager (win_manager*);
00246
00247 static const u_int8 ALIGN_NONE = 0;
00248 static const u_int8 ALIGN_LEFT = 1;
00249 static const u_int8 ALIGN_CENTER = 2;
00250 static const u_int8 ALIGN_RIGHT = 3;
00251
00252 protected:
00253
00254 friend class win_container;
00255
00256 friend class win_scroll;
00257
00258 friend class win_select;
00259
00260 virtual void update_position();
00261
00262 void update_align();
00263
00264 void set_container(win_container * wc);
00265
00266
00267
00268 s_int16 x_;
00269
00270 s_int16 y_;
00271
00272 s_int16 pad_x_;
00273
00274 s_int16 pad_y_;
00275
00276 u_int8 align_;
00277
00278 bool visible_;
00279
00280 bool focus_;
00281
00282 bool activate_;
00283
00284 bool brightness_;
00285
00286 bool trans_;
00287
00288 bool can_be_selected_;
00289
00290 win_container * wb_father_;
00291
00292 win_manager * manager_;
00293 };
00294
00295
00296
00297 #endif
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312