00001 #ifndef _AMIGA_WINDOW_H_
00002 #define _AMIGA_WINDOW_H_
00003
00004 #include <nds.h>
00005 #include "window.h"
00006 #include "gadgeteventhandler.h"
00007
00008 namespace WoopsiUI {
00009
00010 class WindowBorderTop;
00011 class WindowBorderSide;
00012 class WindowBorderBottom;
00013 class WindowBorderButton;
00014
00020 class AmigaWindow : public Window, public GadgetEventHandler {
00021
00022 public:
00023
00027 enum AmigaWindowFlagType {
00028 AMIGA_WINDOW_SHOW_CLOSE = 0x0001,
00029 AMIGA_WINDOW_SHOW_DEPTH = 0x0002
00030 };
00031
00035 typedef struct {
00036 u8 showCloseButton : 1;
00037 u8 showDepthButton : 1;
00038 } AmigaWindowFlags;
00039
00051 AmigaWindow(s16 x, s16 y, u16 width, u16 height, const char* title, u32 flags, u32 windowFlags, FontBase* font = NULL);
00052
00057 virtual void setBorderless(bool isBorderless);
00058
00063 virtual const u8 getBorderSize() const;
00064
00069 virtual const u8 getTitleHeight() const;
00070
00077 virtual void getClientRect(Rect& rect) const;
00078
00085 virtual bool click(s16 x, s16 y);
00086
00091 virtual bool focus();
00092
00097 virtual bool blur();
00098
00105 virtual bool resize(u16 width, u16 height);
00106
00111 virtual void handleClickEvent(const GadgetEventArgs& e);
00112
00117 virtual void handleDragEvent(const GadgetEventArgs& e);
00118
00123 virtual void handleReleaseEvent(const GadgetEventArgs& e);
00124
00129 virtual void handleReleaseOutsideEvent(const GadgetEventArgs& e);
00130
00136 virtual void showCloseButton();
00137
00143 virtual void showDepthButton();
00144
00150 virtual void hideCloseButton();
00151
00157 virtual void hideDepthButton();
00158
00163 virtual inline const bool hasCloseButton() const { return _windowFlags.showCloseButton; };
00164
00169 virtual inline const bool hasDepthButton() const { return _windowFlags.showDepthButton; };
00170
00171 protected:
00172 AmigaWindowFlags _windowFlags;
00174 WindowBorderTop* _windowBorderTop;
00175 WindowBorderSide* _windowBorderLeft;
00176 WindowBorderSide* _windowBorderRight;
00177 WindowBorderBottom* _windowBorderBottom;
00178 WindowBorderButton* _closeButton;
00179 WindowBorderButton* _depthButton;
00184 virtual void createBorder();
00185
00189 virtual inline ~AmigaWindow() { }
00190
00194 inline AmigaWindow(const AmigaWindow& amigaWindow) : Window(amigaWindow) { };
00195 };
00196 }
00197
00198 #endif