aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/include/IGUISkin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/include/IGUISkin.h')
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUISkin.h574
1 files changed, 574 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/include/IGUISkin.h b/src/others/irrlicht-1.8.1/include/IGUISkin.h
new file mode 100644
index 0000000..d3bf337
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUISkin.h
@@ -0,0 +1,574 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_SKIN_H_INCLUDED__
6#define __I_GUI_SKIN_H_INCLUDED__
7
8#include "IAttributeExchangingObject.h"
9#include "EGUIAlignment.h"
10#include "SColor.h"
11#include "rect.h"
12
13namespace irr
14{
15namespace gui
16{
17 class IGUIFont;
18 class IGUISpriteBank;
19 class IGUIElement;
20
21 //! Enumeration of available default skins.
22 /** To set one of the skins, use the following code, for example to set
23 the Windows classic skin:
24 \code
25 gui::IGUISkin* newskin = environment->createSkin(gui::EGST_WINDOWS_CLASSIC);
26 environment->setSkin(newskin);
27 newskin->drop();
28 \endcode
29 */
30 enum EGUI_SKIN_TYPE
31 {
32 //! Default windows look and feel
33 EGST_WINDOWS_CLASSIC=0,
34
35 //! Like EGST_WINDOWS_CLASSIC, but with metallic shaded windows and buttons
36 EGST_WINDOWS_METALLIC,
37
38 //! Burning's skin
39 EGST_BURNING_SKIN,
40
41 //! An unknown skin, not serializable at present
42 EGST_UNKNOWN,
43
44 //! this value is not used, it only specifies the number of skin types
45 EGST_COUNT
46 };
47
48 //! Names for gui element types
49 const c8* const GUISkinTypeNames[EGST_COUNT+1] =
50 {
51 "windowsClassic",
52 "windowsMetallic",
53 "burning",
54 "unknown",
55 0,
56 };
57
58
59 //! Enumeration for skin colors
60 enum EGUI_DEFAULT_COLOR
61 {
62 //! Dark shadow for three-dimensional display elements.
63 EGDC_3D_DARK_SHADOW = 0,
64 //! Shadow color for three-dimensional display elements (for edges facing away from the light source).
65 EGDC_3D_SHADOW,
66 //! Face color for three-dimensional display elements and for dialog box backgrounds.
67 EGDC_3D_FACE,
68 //! Highlight color for three-dimensional display elements (for edges facing the light source.)
69 EGDC_3D_HIGH_LIGHT,
70 //! Light color for three-dimensional display elements (for edges facing the light source.)
71 EGDC_3D_LIGHT,
72 //! Active window border.
73 EGDC_ACTIVE_BORDER,
74 //! Active window title bar text.
75 EGDC_ACTIVE_CAPTION,
76 //! Background color of multiple document interface (MDI) applications.
77 EGDC_APP_WORKSPACE,
78 //! Text on a button
79 EGDC_BUTTON_TEXT,
80 //! Grayed (disabled) text.
81 EGDC_GRAY_TEXT,
82 //! Item(s) selected in a control.
83 EGDC_HIGH_LIGHT,
84 //! Text of item(s) selected in a control.
85 EGDC_HIGH_LIGHT_TEXT,
86 //! Inactive window border.
87 EGDC_INACTIVE_BORDER,
88 //! Inactive window caption.
89 EGDC_INACTIVE_CAPTION,
90 //! Tool tip text color
91 EGDC_TOOLTIP,
92 //! Tool tip background color
93 EGDC_TOOLTIP_BACKGROUND,
94 //! Scrollbar gray area
95 EGDC_SCROLLBAR,
96 //! Window background
97 EGDC_WINDOW,
98 //! Window symbols like on close buttons, scroll bars and check boxes
99 EGDC_WINDOW_SYMBOL,
100 //! Icons in a list or tree
101 EGDC_ICON,
102 //! Selected icons in a list or tree
103 EGDC_ICON_HIGH_LIGHT,
104 //! Grayed (disabled) window symbols like on close buttons, scroll bars and check boxes
105 EGDC_GRAY_WINDOW_SYMBOL,
106 //! Window background for editable field (editbox, checkbox-field)
107 EGDC_EDITABLE,
108 //! Grayed (disabled) window background for editable field (editbox, checkbox-field)
109 EGDC_GRAY_EDITABLE,
110 //! Show focus of window background for editable field (editbox or when checkbox-field is pressed)
111 EGDC_FOCUSED_EDITABLE,
112
113 //! this value is not used, it only specifies the amount of default colors
114 //! available.
115 EGDC_COUNT
116 };
117
118 //! Names for default skin colors
119 const c8* const GUISkinColorNames[EGDC_COUNT+1] =
120 {
121 "3DDarkShadow",
122 "3DShadow",
123 "3DFace",
124 "3DHighlight",
125 "3DLight",
126 "ActiveBorder",
127 "ActiveCaption",
128 "AppWorkspace",
129 "ButtonText",
130 "GrayText",
131 "Highlight",
132 "HighlightText",
133 "InactiveBorder",
134 "InactiveCaption",
135 "ToolTip",
136 "ToolTipBackground",
137 "ScrollBar",
138 "Window",
139 "WindowSymbol",
140 "Icon",
141 "IconHighlight",
142 "GrayWindowSymbol",
143 "Editable",
144 "GrayEditable",
145 "FocusedEditable",
146 0,
147 };
148
149 //! Enumeration for default sizes.
150 enum EGUI_DEFAULT_SIZE
151 {
152 //! default with / height of scrollbar
153 EGDS_SCROLLBAR_SIZE = 0,
154 //! height of menu
155 EGDS_MENU_HEIGHT,
156 //! width of a window button
157 EGDS_WINDOW_BUTTON_WIDTH,
158 //! width of a checkbox check
159 EGDS_CHECK_BOX_WIDTH,
160 //! \deprecated This may be removed by Irrlicht 1.9
161 EGDS_MESSAGE_BOX_WIDTH,
162 //! \deprecated This may be removed by Irrlicht 1.9
163 EGDS_MESSAGE_BOX_HEIGHT,
164 //! width of a default button
165 EGDS_BUTTON_WIDTH,
166 //! height of a default button
167 EGDS_BUTTON_HEIGHT,
168 //! distance for text from background
169 EGDS_TEXT_DISTANCE_X,
170 //! distance for text from background
171 EGDS_TEXT_DISTANCE_Y,
172 //! distance for text in the title bar, from the left of the window rect
173 EGDS_TITLEBARTEXT_DISTANCE_X,
174 //! distance for text in the title bar, from the top of the window rect
175 EGDS_TITLEBARTEXT_DISTANCE_Y,
176 //! free space in a messagebox between borders and contents on all sides
177 EGDS_MESSAGE_BOX_GAP_SPACE,
178 //! minimal space to reserve for messagebox text-width
179 EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH,
180 //! maximal space to reserve for messagebox text-width
181 EGDS_MESSAGE_BOX_MAX_TEXT_WIDTH,
182 //! minimal space to reserve for messagebox text-height
183 EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT,
184 //! maximal space to reserve for messagebox text-height
185 EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT,
186 //! pixels to move the button image to the right when a pushbutton is pressed
187 EGDS_BUTTON_PRESSED_IMAGE_OFFSET_X,
188 //! pixels to move the button image down when a pushbutton is pressed
189 EGDS_BUTTON_PRESSED_IMAGE_OFFSET_Y,
190 //! pixels to move the button text to the right when a pushbutton is pressed
191 EGDS_BUTTON_PRESSED_TEXT_OFFSET_X,
192 //! pixels to move the button text down when a pushbutton is pressed
193 EGDS_BUTTON_PRESSED_TEXT_OFFSET_Y,
194
195 //! this value is not used, it only specifies the amount of default sizes
196 //! available.
197 EGDS_COUNT
198 };
199
200
201 //! Names for default skin sizes
202 const c8* const GUISkinSizeNames[EGDS_COUNT+1] =
203 {
204 "ScrollBarSize",
205 "MenuHeight",
206 "WindowButtonWidth",
207 "CheckBoxWidth",
208 "MessageBoxWidth",
209 "MessageBoxHeight",
210 "ButtonWidth",
211 "ButtonHeight",
212 "TextDistanceX",
213 "TextDistanceY",
214 "TitleBarTextX",
215 "TitleBarTextY",
216 "MessageBoxGapSpace",
217 "MessageBoxMinTextWidth",
218 "MessageBoxMaxTextWidth",
219 "MessageBoxMinTextHeight",
220 "MessageBoxMaxTextHeight",
221 "ButtonPressedImageOffsetX",
222 "ButtonPressedImageOffsetY"
223 "ButtonPressedTextOffsetX",
224 "ButtonPressedTextOffsetY",
225 0
226 };
227
228
229 enum EGUI_DEFAULT_TEXT
230 {
231 //! Text for the OK button on a message box
232 EGDT_MSG_BOX_OK = 0,
233 //! Text for the Cancel button on a message box
234 EGDT_MSG_BOX_CANCEL,
235 //! Text for the Yes button on a message box
236 EGDT_MSG_BOX_YES,
237 //! Text for the No button on a message box
238 EGDT_MSG_BOX_NO,
239 //! Tooltip text for window close button
240 EGDT_WINDOW_CLOSE,
241 //! Tooltip text for window maximize button
242 EGDT_WINDOW_MAXIMIZE,
243 //! Tooltip text for window minimize button
244 EGDT_WINDOW_MINIMIZE,
245 //! Tooltip text for window restore button
246 EGDT_WINDOW_RESTORE,
247
248 //! this value is not used, it only specifies the number of default texts
249 EGDT_COUNT
250 };
251
252 //! Names for default skin sizes
253 const c8* const GUISkinTextNames[EGDT_COUNT+1] =
254 {
255 "MessageBoxOkay",
256 "MessageBoxCancel",
257 "MessageBoxYes",
258 "MessageBoxNo",
259 "WindowButtonClose",
260 "WindowButtonMaximize",
261 "WindowButtonMinimize",
262 "WindowButtonRestore",
263 0
264 };
265
266 //! Customizable symbols for GUI
267 enum EGUI_DEFAULT_ICON
268 {
269 //! maximize window button
270 EGDI_WINDOW_MAXIMIZE = 0,
271 //! restore window button
272 EGDI_WINDOW_RESTORE,
273 //! close window button
274 EGDI_WINDOW_CLOSE,
275 //! minimize window button
276 EGDI_WINDOW_MINIMIZE,
277 //! resize icon for bottom right corner of a window
278 EGDI_WINDOW_RESIZE,
279 //! scroll bar up button
280 EGDI_CURSOR_UP,
281 //! scroll bar down button
282 EGDI_CURSOR_DOWN,
283 //! scroll bar left button
284 EGDI_CURSOR_LEFT,
285 //! scroll bar right button
286 EGDI_CURSOR_RIGHT,
287 //! icon for menu children
288 EGDI_MENU_MORE,
289 //! tick for checkbox
290 EGDI_CHECK_BOX_CHECKED,
291 //! down arrow for dropdown menus
292 EGDI_DROP_DOWN,
293 //! smaller up arrow
294 EGDI_SMALL_CURSOR_UP,
295 //! smaller down arrow
296 EGDI_SMALL_CURSOR_DOWN,
297 //! selection dot in a radio button
298 EGDI_RADIO_BUTTON_CHECKED,
299 //! << icon indicating there is more content to the left
300 EGDI_MORE_LEFT,
301 //! >> icon indicating that there is more content to the right
302 EGDI_MORE_RIGHT,
303 //! icon indicating that there is more content above
304 EGDI_MORE_UP,
305 //! icon indicating that there is more content below
306 EGDI_MORE_DOWN,
307 //! plus icon for trees
308 EGDI_EXPAND,
309
310 //! minus icon for trees
311 EGDI_COLLAPSE,
312 //! file icon for file selection
313 EGDI_FILE,
314 //! folder icon for file selection
315 EGDI_DIRECTORY,
316
317 //! value not used, it only specifies the number of icons
318 EGDI_COUNT
319 };
320
321 const c8* const GUISkinIconNames[EGDI_COUNT+1] =
322 {
323 "windowMaximize",
324 "windowRestore",
325 "windowClose",
326 "windowMinimize",
327 "windowResize",
328 "cursorUp",
329 "cursorDown",
330 "cursorLeft",
331 "cursorRight",
332 "menuMore",
333 "checkBoxChecked",
334 "dropDown",
335 "smallCursorUp",
336 "smallCursorDown",
337 "radioButtonChecked",
338 "moreLeft",
339 "moreRight",
340 "moreUp",
341 "moreDown",
342 "expand",
343 "collapse",
344 "file",
345 "directory",
346 0
347 };
348
349 // Customizable fonts
350 enum EGUI_DEFAULT_FONT
351 {
352 //! For static text, edit boxes, lists and most other places
353 EGDF_DEFAULT=0,
354 //! Font for buttons
355 EGDF_BUTTON,
356 //! Font for window title bars
357 EGDF_WINDOW,
358 //! Font for menu items
359 EGDF_MENU,
360 //! Font for tooltips
361 EGDF_TOOLTIP,
362 //! this value is not used, it only specifies the amount of default fonts
363 //! available.
364 EGDF_COUNT
365 };
366
367 const c8* const GUISkinFontNames[EGDF_COUNT+1] =
368 {
369 "defaultFont",
370 "buttonFont",
371 "windowFont",
372 "menuFont",
373 "tooltipFont",
374 0
375 };
376
377 //! A skin modifies the look of the GUI elements.
378 class IGUISkin : public virtual io::IAttributeExchangingObject
379 {
380 public:
381
382 //! returns default color
383 virtual video::SColor getColor(EGUI_DEFAULT_COLOR color) const = 0;
384
385 //! sets a default color
386 virtual void setColor(EGUI_DEFAULT_COLOR which, video::SColor newColor) = 0;
387
388 //! returns size for the given size type
389 virtual s32 getSize(EGUI_DEFAULT_SIZE size) const = 0;
390
391 //! Returns a default text.
392 /** For example for Message box button captions:
393 "OK", "Cancel", "Yes", "No" and so on. */
394 virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const = 0;
395
396 //! Sets a default text.
397 /** For example for Message box button captions:
398 "OK", "Cancel", "Yes", "No" and so on. */
399 virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText) = 0;
400
401 //! sets a default size
402 virtual void setSize(EGUI_DEFAULT_SIZE which, s32 size) = 0;
403
404 //! returns the default font
405 virtual IGUIFont* getFont(EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const = 0;
406
407 //! sets a default font
408 virtual void setFont(IGUIFont* font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT) = 0;
409
410 //! returns the sprite bank
411 virtual IGUISpriteBank* getSpriteBank() const = 0;
412
413 //! sets the sprite bank
414 virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
415
416 //! Returns a default icon
417 /** Returns the sprite index within the sprite bank */
418 virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const = 0;
419
420 //! Sets a default icon
421 /** Sets the sprite index used for drawing icons like arrows,
422 close buttons and ticks in checkboxes
423 \param icon: Enum specifying which icon to change
424 \param index: The sprite index used to draw this icon */
425 virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index) = 0;
426
427 //! draws a standard 3d button pane
428 /** Used for drawing for example buttons in normal state.
429 It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
430 EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
431 \param element: Pointer to the element which wishes to draw this. This parameter
432 is usually not used by IGUISkin, but can be used for example by more complex
433 implementations to find out how to draw the part exactly.
434 \param rect: Defining area where to draw.
435 \param clip: Clip area. */
436 virtual void draw3DButtonPaneStandard(IGUIElement* element,
437 const core::rect<s32>& rect,
438 const core::rect<s32>* clip=0) = 0;
439
440 //! draws a pressed 3d button pane
441 /** Used for drawing for example buttons in pressed state.
442 It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
443 EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
444 \param element: Pointer to the element which wishes to draw this. This parameter
445 is usually not used by IGUISkin, but can be used for example by more complex
446 implementations to find out how to draw the part exactly.
447 \param rect: Defining area where to draw.
448 \param clip: Clip area. */
449 virtual void draw3DButtonPanePressed(IGUIElement* element,
450 const core::rect<s32>& rect,
451 const core::rect<s32>* clip=0) = 0;
452
453 //! draws a sunken 3d pane
454 /** Used for drawing the background of edit, combo or check boxes.
455 \param element: Pointer to the element which wishes to draw this. This parameter
456 is usually not used by IGUISkin, but can be used for example by more complex
457 implementations to find out how to draw the part exactly.
458 \param bgcolor: Background color.
459 \param flat: Specifies if the sunken pane should be flat or displayed as sunken
460 deep into the ground.
461 \param fillBackGround: Specifies if the background should be filled with the background
462 color or not be drawn at all.
463 \param rect: Defining area where to draw.
464 \param clip: Clip area. */
465 virtual void draw3DSunkenPane(IGUIElement* element,
466 video::SColor bgcolor, bool flat, bool fillBackGround,
467 const core::rect<s32>& rect,
468 const core::rect<s32>* clip=0) = 0;
469
470 //! draws a window background
471 /** Used for drawing the background of dialogs and windows.
472 \param element: Pointer to the element which wishes to draw this. This parameter
473 is usually not used by IGUISkin, but can be used for example by more complex
474 implementations to find out how to draw the part exactly.
475 \param titleBarColor: Title color.
476 \param drawTitleBar: True to enable title drawing.
477 \param rect: Defining area where to draw.
478 \param clip: Clip area.
479 \param checkClientArea: When set to non-null the function will not draw anything,
480 but will instead return the clientArea which can be used for drawing by the calling window.
481 That is the area without borders and without titlebar.
482 \return Returns rect where it would be good to draw title bar text. This will
483 work even when checkClientArea is set to a non-null value.*/
484 virtual core::rect<s32> draw3DWindowBackground(IGUIElement* element,
485 bool drawTitleBar, video::SColor titleBarColor,
486 const core::rect<s32>& rect,
487 const core::rect<s32>* clip=0,
488 core::rect<s32>* checkClientArea=0) = 0;
489
490 //! draws a standard 3d menu pane
491 /** Used for drawing for menus and context menus.
492 It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and
493 EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details.
494 \param element: Pointer to the element which wishes to draw this. This parameter
495 is usually not used by IGUISkin, but can be used for example by more complex
496 implementations to find out how to draw the part exactly.
497 \param rect: Defining area where to draw.
498 \param clip: Clip area. */
499 virtual void draw3DMenuPane(IGUIElement* element,
500 const core::rect<s32>& rect,
501 const core::rect<s32>* clip=0) = 0;
502
503 //! draws a standard 3d tool bar
504 /** Used for drawing for toolbars and menus.
505 \param element: Pointer to the element which wishes to draw this. This parameter
506 is usually not used by IGUISkin, but can be used for example by more complex
507 implementations to find out how to draw the part exactly.
508 \param rect: Defining area where to draw.
509 \param clip: Clip area. */
510 virtual void draw3DToolBar(IGUIElement* element,
511 const core::rect<s32>& rect,
512 const core::rect<s32>* clip=0) = 0;
513
514 //! draws a tab button
515 /** Used for drawing for tab buttons on top of tabs.
516 \param element: Pointer to the element which wishes to draw this. This parameter
517 is usually not used by IGUISkin, but can be used for example by more complex
518 implementations to find out how to draw the part exactly.
519 \param active: Specifies if the tab is currently active.
520 \param rect: Defining area where to draw.
521 \param clip: Clip area.
522 \param alignment Alignment of GUI element. */
523 virtual void draw3DTabButton(IGUIElement* element, bool active,
524 const core::rect<s32>& rect, const core::rect<s32>* clip=0, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT) = 0;
525
526 //! draws a tab control body
527 /** \param element: Pointer to the element which wishes to draw this. This parameter
528 is usually not used by IGUISkin, but can be used for example by more complex
529 implementations to find out how to draw the part exactly.
530 \param border: Specifies if the border should be drawn.
531 \param background: Specifies if the background should be drawn.
532 \param rect: Defining area where to draw.
533 \param clip: Clip area.
534 \param tabHeight Height of tab.
535 \param alignment Alignment of GUI element. */
536 virtual void draw3DTabBody(IGUIElement* element, bool border, bool background,
537 const core::rect<s32>& rect, const core::rect<s32>* clip=0, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT ) = 0;
538
539 //! draws an icon, usually from the skin's sprite bank
540 /** \param element: Pointer to the element which wishes to draw this icon.
541 This parameter is usually not used by IGUISkin, but can be used for example
542 by more complex implementations to find out how to draw the part exactly.
543 \param icon: Specifies the icon to be drawn.
544 \param position: The position to draw the icon
545 \param starttime: The time at the start of the animation
546 \param currenttime: The present time, used to calculate the frame number
547 \param loop: Whether the animation should loop or not
548 \param clip: Clip area. */
549 virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
550 const core::position2di position, u32 starttime=0, u32 currenttime=0,
551 bool loop=false, const core::rect<s32>* clip=0) = 0;
552
553 //! draws a 2d rectangle.
554 /** \param element: Pointer to the element which wishes to draw this icon.
555 This parameter is usually not used by IGUISkin, but can be used for example
556 by more complex implementations to find out how to draw the part exactly.
557 \param color: Color of the rectangle to draw. The alpha component specifies how
558 transparent the rectangle will be.
559 \param pos: Position of the rectangle.
560 \param clip: Pointer to rectangle against which the rectangle will be clipped.
561 If the pointer is null, no clipping will be performed. */
562 virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color,
563 const core::rect<s32>& pos, const core::rect<s32>* clip = 0) = 0;
564
565 //! get the type of this skin
566 virtual EGUI_SKIN_TYPE getType() const { return EGST_UNKNOWN; }
567 };
568
569
570} // end namespace gui
571} // end namespace irr
572
573#endif
574