Irrlicht 3D Engine
IGUISkin.h
Go to the documentation of this file.
00001 // Copyright (C) 2002-2012 Nikolaus Gebhardt
00002 // This file is part of the "Irrlicht Engine".
00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
00004 
00005 #ifndef __I_GUI_SKIN_H_INCLUDED__
00006 #define __I_GUI_SKIN_H_INCLUDED__
00007 
00008 #include "IAttributeExchangingObject.h"
00009 #include "EGUIAlignment.h"
00010 #include "SColor.h"
00011 #include "rect.h"
00012 
00013 namespace irr
00014 {
00015 namespace gui
00016 {
00017     class IGUIFont;
00018     class IGUISpriteBank;
00019     class IGUIElement;
00020 
00022 
00030     enum EGUI_SKIN_TYPE
00031     {
00033         EGST_WINDOWS_CLASSIC=0,
00034 
00036         EGST_WINDOWS_METALLIC,
00037 
00039         EGST_BURNING_SKIN,
00040 
00042         EGST_UNKNOWN,
00043 
00045         EGST_COUNT
00046     };
00047 
00049     const c8* const GUISkinTypeNames[EGST_COUNT+1] =
00050     {
00051         "windowsClassic",
00052         "windowsMetallic",
00053         "burning",
00054         "unknown",
00055         0,
00056     };
00057 
00058 
00060     enum EGUI_DEFAULT_COLOR
00061     {
00063         EGDC_3D_DARK_SHADOW = 0,
00065         EGDC_3D_SHADOW,
00067         EGDC_3D_FACE,
00069         EGDC_3D_HIGH_LIGHT,
00071         EGDC_3D_LIGHT,
00073         EGDC_ACTIVE_BORDER,
00075         EGDC_ACTIVE_CAPTION,
00077         EGDC_APP_WORKSPACE,
00079         EGDC_BUTTON_TEXT,
00081         EGDC_GRAY_TEXT,
00083         EGDC_HIGH_LIGHT,
00085         EGDC_HIGH_LIGHT_TEXT,
00087         EGDC_INACTIVE_BORDER,
00089         EGDC_INACTIVE_CAPTION,
00091         EGDC_TOOLTIP,
00093         EGDC_TOOLTIP_BACKGROUND,
00095         EGDC_SCROLLBAR,
00097         EGDC_WINDOW,
00099         EGDC_WINDOW_SYMBOL,
00101         EGDC_ICON,
00103         EGDC_ICON_HIGH_LIGHT,
00105         EGDC_GRAY_WINDOW_SYMBOL,
00107         EGDC_EDITABLE,
00109         EGDC_GRAY_EDITABLE,
00111         EGDC_FOCUSED_EDITABLE,
00112 
00115         EGDC_COUNT
00116     };
00117 
00119     const c8* const GUISkinColorNames[EGDC_COUNT+1] =
00120     {
00121         "3DDarkShadow",
00122         "3DShadow",
00123         "3DFace",
00124         "3DHighlight",
00125         "3DLight",
00126         "ActiveBorder",
00127         "ActiveCaption",
00128         "AppWorkspace",
00129         "ButtonText",
00130         "GrayText",
00131         "Highlight",
00132         "HighlightText",
00133         "InactiveBorder",
00134         "InactiveCaption",
00135         "ToolTip",
00136         "ToolTipBackground",
00137         "ScrollBar",
00138         "Window",
00139         "WindowSymbol",
00140         "Icon",
00141         "IconHighlight",
00142         "GrayWindowSymbol",
00143         "Editable",
00144         "GrayEditable",
00145         "FocusedEditable",
00146         0,
00147     };
00148 
00150     enum EGUI_DEFAULT_SIZE
00151     {
00153         EGDS_SCROLLBAR_SIZE = 0,
00155         EGDS_MENU_HEIGHT,
00157         EGDS_WINDOW_BUTTON_WIDTH,
00159         EGDS_CHECK_BOX_WIDTH,
00161         EGDS_MESSAGE_BOX_WIDTH,
00163         EGDS_MESSAGE_BOX_HEIGHT,
00165         EGDS_BUTTON_WIDTH,
00167         EGDS_BUTTON_HEIGHT,
00169         EGDS_TEXT_DISTANCE_X,
00171         EGDS_TEXT_DISTANCE_Y,
00173         EGDS_TITLEBARTEXT_DISTANCE_X,
00175         EGDS_TITLEBARTEXT_DISTANCE_Y,
00177         EGDS_MESSAGE_BOX_GAP_SPACE,
00179         EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH,
00181         EGDS_MESSAGE_BOX_MAX_TEXT_WIDTH,
00183         EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT,
00185         EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT,
00187         EGDS_BUTTON_PRESSED_IMAGE_OFFSET_X,
00189         EGDS_BUTTON_PRESSED_IMAGE_OFFSET_Y,
00191         EGDS_BUTTON_PRESSED_TEXT_OFFSET_X,
00193         EGDS_BUTTON_PRESSED_TEXT_OFFSET_Y,
00194 
00197         EGDS_COUNT
00198     };
00199 
00200 
00202     const c8* const GUISkinSizeNames[EGDS_COUNT+1] =
00203     {
00204         "ScrollBarSize",
00205         "MenuHeight",
00206         "WindowButtonWidth",
00207         "CheckBoxWidth",
00208         "MessageBoxWidth",
00209         "MessageBoxHeight",
00210         "ButtonWidth",
00211         "ButtonHeight",
00212         "TextDistanceX",
00213         "TextDistanceY",
00214         "TitleBarTextX",
00215         "TitleBarTextY",
00216         "MessageBoxGapSpace",
00217         "MessageBoxMinTextWidth",
00218         "MessageBoxMaxTextWidth",
00219         "MessageBoxMinTextHeight",
00220         "MessageBoxMaxTextHeight",
00221         "ButtonPressedImageOffsetX",
00222         "ButtonPressedImageOffsetY"
00223         "ButtonPressedTextOffsetX",
00224         "ButtonPressedTextOffsetY",
00225         0
00226     };
00227 
00228 
00229     enum EGUI_DEFAULT_TEXT
00230     {
00232         EGDT_MSG_BOX_OK = 0,
00234         EGDT_MSG_BOX_CANCEL,
00236         EGDT_MSG_BOX_YES,
00238         EGDT_MSG_BOX_NO,
00240         EGDT_WINDOW_CLOSE,
00242         EGDT_WINDOW_MAXIMIZE,
00244         EGDT_WINDOW_MINIMIZE,
00246         EGDT_WINDOW_RESTORE,
00247 
00249         EGDT_COUNT
00250     };
00251 
00253     const c8* const GUISkinTextNames[EGDT_COUNT+1] =
00254     {
00255         "MessageBoxOkay",
00256         "MessageBoxCancel",
00257         "MessageBoxYes",
00258         "MessageBoxNo",
00259         "WindowButtonClose",
00260         "WindowButtonMaximize",
00261         "WindowButtonMinimize",
00262         "WindowButtonRestore",
00263         0
00264     };
00265 
00267     enum EGUI_DEFAULT_ICON
00268     {
00270         EGDI_WINDOW_MAXIMIZE = 0,
00272         EGDI_WINDOW_RESTORE,
00274         EGDI_WINDOW_CLOSE,
00276         EGDI_WINDOW_MINIMIZE,
00278         EGDI_WINDOW_RESIZE,
00280         EGDI_CURSOR_UP,
00282         EGDI_CURSOR_DOWN,
00284         EGDI_CURSOR_LEFT,
00286         EGDI_CURSOR_RIGHT,
00288         EGDI_MENU_MORE,
00290         EGDI_CHECK_BOX_CHECKED,
00292         EGDI_DROP_DOWN,
00294         EGDI_SMALL_CURSOR_UP,
00296         EGDI_SMALL_CURSOR_DOWN,
00298         EGDI_RADIO_BUTTON_CHECKED,
00300         EGDI_MORE_LEFT,
00302         EGDI_MORE_RIGHT,
00304         EGDI_MORE_UP,
00306         EGDI_MORE_DOWN,
00308         EGDI_EXPAND,
00309 
00311         EGDI_COLLAPSE,
00313         EGDI_FILE,
00315         EGDI_DIRECTORY,
00316 
00318         EGDI_COUNT
00319     };
00320 
00321     const c8* const GUISkinIconNames[EGDI_COUNT+1] =
00322     {
00323         "windowMaximize",
00324         "windowRestore",
00325         "windowClose",
00326         "windowMinimize",
00327         "windowResize",
00328         "cursorUp",
00329         "cursorDown",
00330         "cursorLeft",
00331         "cursorRight",
00332         "menuMore",
00333         "checkBoxChecked",
00334         "dropDown",
00335         "smallCursorUp",
00336         "smallCursorDown",
00337         "radioButtonChecked",
00338         "moreLeft",
00339         "moreRight",
00340         "moreUp",
00341         "moreDown",
00342         "expand",
00343         "collapse",
00344         "file",
00345         "directory",
00346         0
00347     };
00348 
00349     // Customizable fonts
00350     enum EGUI_DEFAULT_FONT
00351     {
00353         EGDF_DEFAULT=0,
00355         EGDF_BUTTON,
00357         EGDF_WINDOW,
00359         EGDF_MENU,
00361         EGDF_TOOLTIP,
00364         EGDF_COUNT
00365     };
00366 
00367     const c8* const GUISkinFontNames[EGDF_COUNT+1] =
00368     {
00369         "defaultFont",
00370         "buttonFont",
00371         "windowFont",
00372         "menuFont",
00373         "tooltipFont",
00374         0
00375     };
00376 
00378     class IGUISkin : public virtual io::IAttributeExchangingObject
00379     {
00380     public:
00381 
00383         virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const = 0;
00384 
00386         virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor) = 0;
00387 
00389         virtual s32 getSize(EGUI_DEFAULT_SIZE size) const = 0;
00390 
00392 
00394         virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const = 0;
00395 
00397 
00399         virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText) = 0;
00400 
00402         virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size) = 0;
00403 
00405         virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const = 0;
00406 
00408         virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT) = 0;
00409 
00411         virtual IGUISpriteBank* getSpriteBank() const = 0;
00412 
00414         virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
00415 
00417 
00418         virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const = 0;
00419 
00421 
00425         virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index) = 0;
00426 
00428 
00436         virtual void draw3DButtonPaneStandard(IGUIElement* element,
00437             const core::rect<s32>& rect,
00438             const core::rect<s32>* clip=0) = 0;
00439 
00441 
00449         virtual void draw3DButtonPanePressed(IGUIElement* element,
00450             const core::rect<s32>& rect,
00451             const core::rect<s32>* clip=0) = 0;
00452 
00454 
00465         virtual void draw3DSunkenPane(IGUIElement* element,
00466             video::SColor bgcolor, bool flat, bool fillBackGround,
00467             const core::rect<s32>& rect,
00468             const core::rect<s32>* clip=0) = 0;
00469 
00471 
00484         virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
00485             bool drawTitleBar, video::SColor titleBarColor,
00486             const core::rect<s32>& rect,
00487             const core::rect<s32>* clip=0,
00488             core::rect<s32>* checkClientArea=0) = 0;
00489 
00491 
00499         virtual void draw3DMenuPane(IGUIElement* element,
00500             const core::rect<s32>& rect,
00501             const core::rect<s32>* clip=0) = 0;
00502 
00504 
00510         virtual void draw3DToolBar(IGUIElement* element,
00511             const core::rect<s32>& rect,
00512             const core::rect<s32>* clip=0) = 0;
00513 
00515 
00523         virtual void draw3DTabButton(IGUIElement* element, bool active,
00524             const core::rect<s32>& rect, const core::rect<s32>* clip=0, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT) = 0;
00525 
00527 
00536         virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
00537             const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT ) = 0;
00538 
00540 
00549         virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
00550             const core::position2di position, u32 starttime=0, u32 currenttime=0,
00551             bool loop=false, const core::rect<s32>* clip=0) = 0;
00552 
00554 
00562         virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
00563             const core::rect<s32>& pos, const core::rect<s32>* clip = 0) = 0;
00564 
00566         virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; }
00567     };
00568 
00569 
00570 } // end namespace gui
00571 } // end namespace irr
00572 
00573 #endif
00574