Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- File List

# amigawindow.h

    00001 #ifndef _AMIGA_WINDOW_H_
    00002 #define _AMIGA_WINDOW_H_
    00003
    00004 #include <nds.h>
    00005 #include "window.h"
    00006 #include "gadgeteventhandler.h"
    00007 #include "gadgetstyle.h"
    00008 #include "woopsistring.h"
    00009
    00010 const s32 WINDOW_TITLE_HEIGHT = 13;
    00011 const s32 WINDOW_BORDER_SIZE = 4;
    00012 const s32 WINDOW_CLOSE_BUTTON_WIDTH = 14;
    00013 const s32 WINDOW_DEPTH_BUTTON_WIDTH = 14;
    00014
    00015 namespace WoopsiUI {
    00016
    00017         class WindowBorderButton;
    00018
    00024         class AmigaWindow : public Window, public GadgetEventHandler {
    00025
    00026         public:
    00027
    00031                 enum AmigaWindowFlagType {
    00032                         AMIGA_WINDOW_SHOW_CLOSE = 0x0001,
    00033                         AMIGA_WINDOW_SHOW_DEPTH = 0x0002
    00034                 };
    00035
    00039                 typedef struct {
    00040                         u8 showCloseButton : 1;
    00041                         u8 showDepthButton : 1;
    00042                 } AmigaWindowFlags;
    00043
    00058                 AmigaWindow(s16 x, s16 y, u16 width, u16 height, const WoopsiString& title, u32 flags, u32 windowFlags, GadgetStyle* style = NULL);
    00059
    00064                 virtual void setBorderless(bool isBorderless);
    00065
    00070                 virtual void handleReleaseEvent(const GadgetEventArgs& e);
    00071
    00076                 virtual void showCloseButton();
    00077
    00082                 virtual void showDepthButton();
    00083
    00088                 virtual void hideCloseButton();
    00089
    00094                 virtual void hideDepthButton();
    00095
    00100                 virtual inline const bool hasCloseButton() const { return _windowFlags.showCloseButton; };
    00101
    00106                 virtual inline const bool hasDepthButton() const { return _windowFlags.showDepthButton; };
    00107
    00108         protected:
    00109                 AmigaWindowFlags _windowFlags;
    00111                 WindowBorderButton* _closeButton;
    00112                 WindowBorderButton* _depthButton;
    00120                 virtual void drawBorder(GraphicsPort* port);
    00121
    00127                 virtual void onResize(u16 width, u16 height);
    00128
    00132                 virtual void onFocus();
    00133
    00137                 virtual void onBlur();
    00138
    00146                 virtual void onClick(s16 x, s16 y);
    00147
    00151                 virtual void createBorder();
    00152
    00156                 virtual void markBorderDirty();
    00157
    00161                 virtual inline ~AmigaWindow() { }
    00162
    00166                 inline AmigaWindow(const AmigaWindow& amigaWindow) : Window(amigaWindow) { };
    00167         };
    00168 }
    00169
    00170 #endif