00001
00002
00003
00004
00005
00006
00007
00009
00016 #ifndef __MENU_WINDOW_HEADER__
00017 #define __MENU_WINDOW_HEADER__
00018
00019 #include "defs.h"
00020 #include "utils.h"
00021 #include "gui.h"
00022 #include "screen_rect.h"
00023 #include "image.h"
00024
00025 namespace hoa_video {
00026
00028 const int32 VIDEO_MENU_SCROLL_TIME = 200;
00029
00030
00038 const int32 VIDEO_MENU_EDGE_LEFT = 0x1;
00039 const int32 VIDEO_MENU_EDGE_RIGHT = 0x2;
00040 const int32 VIDEO_MENU_EDGE_TOP = 0x4;
00041 const int32 VIDEO_MENU_EDGE_BOTTOM = 0x8;
00042 const int32 VIDEO_MENU_EDGE_ALL = 0xF;
00044
00045
00051 enum VIDEO_MENU_DISPLAY_MODE {
00052 VIDEO_MENU_INVALID = -1,
00053 VIDEO_MENU_INSTANT = 0,
00054 VIDEO_MENU_EXPAND_FROM_CENTER = 1,
00055 VIDEO_MENU_TOTAL = 2
00056 };
00057
00058
00066 enum VIDEO_MENU_STATE {
00067 VIDEO_MENU_STATE_INVALID = -1,
00068 VIDEO_MENU_STATE_SHOWN = 0,
00069 VIDEO_MENU_STATE_SHOWING = 1,
00070 VIDEO_MENU_STATE_HIDING = 2,
00071 VIDEO_MENU_STATE_HIDDEN = 3,
00072 VIDEO_MENU_STATE_TOTAL = 4
00073 };
00074
00075
00076 namespace private_video {
00077
00094 class MenuSkin {
00095 public:
00108 StillImage borders[3][3];
00109
00119 StillImage connectors[5];
00120
00122 StillImage background;
00123
00124 MenuSkin()
00125 {}
00126
00127 ~MenuSkin()
00128 {}
00129 };
00130
00131 }
00132
00133
00144 class MenuWindow : public private_video::GUIElement {
00145 friend class private_video::GUISupervisor;
00146 public:
00147 MenuWindow();
00148
00149 ~MenuWindow()
00150 {}
00151
00163 bool Create(std::string skin_name, float w, float h, int32 visible_flags = VIDEO_MENU_EDGE_ALL, int32 shared_flags = 0);
00164
00166 bool Create(float w, float h, int32 visible_flags = VIDEO_MENU_EDGE_ALL, int32 shared_flags = 0);
00167
00171 void Destroy();
00172
00176 void Update(uint32 frame_time);
00177
00179 void Draw();
00180
00187 void Show();
00188
00197 void Hide();
00198
00207 bool IsInitialized(std::string &errors);
00208
00213 void ChangeEdgeVisibleFlags(int32 flags);
00214
00219 void ChangeEdgeSharedFlags(int32 flags);
00220
00226 void ChangeMenuSkin(std::string& skin_name);
00227
00229
00230 void SetDisplayMode(VIDEO_MENU_DISPLAY_MODE mode);
00231
00232 void GetDimensions(float &w, float &h) const
00233 { w = _width; h = _height; }
00234
00235 VIDEO_MENU_DISPLAY_MODE GetDisplayMode() const
00236 { return _display_mode; }
00237
00238 VIDEO_MENU_STATE GetState() const
00239 { return _window_state; }
00240
00241 ScreenRect GetScissorRect() const
00242 { return _scissor_rect; }
00244
00245 private:
00247 int32 _id;
00248
00250 float _width, _height;
00251
00253 float _inner_width, _inner_height;
00254
00256 int32 _edge_visible_flags;
00257
00259 int32 _edge_shared_flags;
00260
00262 private_video::MenuSkin* _skin;
00263
00265 VIDEO_MENU_STATE _window_state;
00266
00268 int32 _display_timer;
00269
00271 StillImage _menu_image;
00272
00274 VIDEO_MENU_DISPLAY_MODE _display_mode;
00275
00277 bool _is_scissored;
00278
00280 ScreenRect _scissor_rect;
00281
00290 bool _RecreateImage();
00291 };
00292
00293 }
00294
00295 #endif // __MENU_WINDOW_HEADER__