00001 /*************************************************************************** 00002 * Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider, * 00003 * Matthias Hardt, Guido Madaus * 00004 * * 00005 * Copyright (C) 2007-2008 BerLinux Solutions GbR * 00006 * Stefan Schwarzer & Guido Madaus * 00007 * * 00008 * Copyright (C) 2009-2012 BerLinux Solutions GmbH * 00009 * * 00010 * Authors: * 00011 * Stefan Schwarzer <stefan.schwarzer@diskohq.org>, * 00012 * Matthias Hardt <matthias.hardt@diskohq.org>, * 00013 * Jens Schneider <jens.schneider@diskohq.org>, * 00014 * Guido Madaus <guido.madaus@diskohq.org>, * 00015 * Patrick Helterhoff <patrick.helterhoff@diskohq.org>, * 00016 * René Bählkow <rene.baehlkow@diskohq.org> * 00017 * * 00018 * This library is free software; you can redistribute it and/or * 00019 * modify it under the terms of the GNU Lesser General Public * 00020 * License version 2.1 as published by the Free Software Foundation. * 00021 * * 00022 * This library is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00025 * Lesser General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU Lesser General Public * 00028 * License along with this library; if not, write to the * 00029 * Free Software Foundation, Inc., * 00030 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00031 **************************************************************************/ 00032 00033 #ifndef MMSWINDOW_H_ 00034 #define MMSWINDOW_H_ 00035 00036 #include "mmsgui/mmswidget.h" 00037 #include "mmsgui/mmswindowaction.h" 00038 #include "mmsgui/mmsimagemanager.h" 00039 #include "mmsgui/mmsfontmanager.h" 00040 #include "mmsgui/mmsfbmanager.h" 00041 #include "mmsgui/interfaces/immswindowmanager.h" 00042 #include "mmstools/mmsmutex.h" 00043 #include "mmstools/mmspulser.h" 00044 00045 // support old renamed methods 00046 #define searchForWindow findWindow 00047 #define searchForWidget findWidget 00048 #define searchForWidgetType findWidgetType 00049 00050 //! The available types of windows. 00051 typedef enum { 00052 /*! 00053 Main windows will be displayed over the root window. 00054 Only one main window can be shown at the same time. 00055 If a main window appears the currently shown main window will be disappear. 00056 */ 00057 MMSWINDOWTYPE_MAINWINDOW = 0, 00058 /*! 00059 Popup windows will be displayed over root and main windows. 00060 The popup window which appears finally is on the top of the screen. 00061 */ 00062 MMSWINDOWTYPE_POPUPWINDOW, 00063 /*! 00064 Root windows will be displayed in the background. 00065 Only one root window can be shown at the same time. 00066 If a root window appears the currently shown root window will be disappear. 00067 */ 00068 MMSWINDOWTYPE_ROOTWINDOW, 00069 /*! 00070 Child windows are parts of main, popup and root windows. 00071 The full window functionality is given. 00072 */ 00073 MMSWINDOWTYPE_CHILDWINDOW 00074 } MMSWINDOWTYPE; 00075 00076 //! The available window flags. 00077 typedef enum { 00078 //! none 00079 MMSW_NONE = 0x00000000, 00080 //! The window displays a video stream and should be on the video layer if it exists. 00081 MMSW_VIDEO = 0x00000001, 00082 //! The window should use the graphics layer. 00083 MMSW_USEGRAPHICSLAYER = 0x00000002 00084 } MMSWINDOW_FLAGS; 00085 00086 class MMSChildWindow; 00087 00088 //! current mode of the pulser 00089 typedef enum { 00090 //! show action 00091 MMSWINDOW_PULSER_MODE_SHOW = 0, 00092 //! hide action 00093 MMSWINDOW_PULSER_MODE_HIDE 00094 } MMSWINDOW_PULSER_MODE; 00095 00096 //! This class is the base class for all windows. 00097 /*! 00098 This class includes the base functionality available for all windows within MMSGUI. 00099 This class cannot be constructed. Only windows which are derived from this class can be constructed. 00100 \author Jens Schneider 00101 */ 00102 class MMSWindow { 00103 private: 00104 00105 //! describes a child window 00106 typedef struct { 00107 //! points to the child window 00108 MMSWindow *window; 00109 //! region of the window within parent window 00110 MMSFBRegion region; 00111 //! opacity of the window 00112 unsigned char opacity; 00113 //! old opacity of the window 00114 unsigned char oldopacity; 00115 //! save the last focused widget here 00116 unsigned int focusedWidget; 00117 //! special blit done 00118 bool special_blit; 00119 } CHILDWINS; 00120 00121 //! status area for the arrow widgets 00122 typedef struct { 00123 //! currently navigate up is possible? 00124 bool up; 00125 //! currently navigate down is possible? 00126 bool down; 00127 //! currently navigate left is possible? 00128 bool left; 00129 //! currently navigate right is possible? 00130 bool right; 00131 } ARROW_WIDGET_STATUS; 00132 00133 //! type of the window 00134 MMSWINDOWTYPE type; 00135 00136 //! access to the theme which is used 00137 MMSTheme *theme; 00138 00139 //! base attributes of the window 00140 /*! 00141 This can be initialization values from theme.cpp 00142 or from theme.xml (NOT a <class/> definition, but e.g. tag <mainwindow/>). 00143 */ 00144 MMSWindowClass *baseWindowClass; 00145 00146 //! attributes set by <class/> tag in theme.xml 00147 /*! 00148 Is NULL, if window has no theme class definition. 00149 Attributes set here, prevails over attributes from baseWindowClass. 00150 */ 00151 MMSWindowClass *windowClass; 00152 00153 //! attributes of the window which will be set during the runtime 00154 /*! 00155 The runtime attributes set here (e.g. window->setAlignment(...) ), prevails over attributes 00156 from windowClass and baseWindowClass. 00157 */ 00158 MMSWindowClass myWindowClass; 00159 00160 //! window creation flags 00161 MMSWINDOW_FLAGS flags; 00162 00163 //! to make it thread-safe :) 00164 MMSMutex Lock; 00165 00166 //! save the id of the thread which has locked the window 00167 unsigned long TID; 00168 00169 //! count the number of times the thread has call lock() because it is not a problem, that the same thread calls lock() several times 00170 unsigned long Lock_cnt; 00171 00172 //! special draw lock 00173 MMSMutex drawLock; 00174 00175 //! special flip lock 00176 MMSMutex flipLock; 00177 00178 //! lock the pre-calculation of the navigation 00179 MMSMutex preCalcNaviLock; 00180 00181 //! is window initialized? 00182 bool initialized; 00183 00184 //! pre-calc navigation done? 00185 bool precalcnav; 00186 00187 //! name of the window 00188 string name; 00189 00190 //! parent window (if window is a child window) or NULL 00191 MMSWindow *parent; 00192 00193 //! toplevel parent window (if window is a child window) or NULL 00194 MMSWindow *toplevel_parent; 00195 00196 //! image manager for the window (layer 1) 00197 static MMSImageManager *im1; 00198 00199 //! layer for im1 00200 static MMSFBLayer *im1_layer; 00201 00202 //! image manager for the window (layer 2) 00203 static MMSImageManager *im2; 00204 00205 //! layer for im2 00206 static MMSFBLayer *im2_layer; 00207 00208 //! image manager for the window 00209 MMSImageManager *im; 00210 00211 //! font manager for the window 00212 static MMSFontManager *fm; 00213 00214 //! window action thread (used for animations) 00215 MMSWindowAction *action; 00216 00217 //! background image 00218 MMSFBSurface *bgimage; 00219 00220 //! background image set by application 00221 bool bgimage_from_external; 00222 00223 //! border images 00224 MMSFBSurface *borderimages[MMSBORDER_IMAGE_NUM_SIZE]; 00225 00226 //! border geometry 00227 MMSFBRectangle bordergeom[MMSBORDER_IMAGE_NUM_SIZE]; 00228 00229 //! border geometry set? 00230 bool bordergeomset; 00231 00232 //! access to the MMSFBLayer on which the window has to be displayed 00233 MMSFBLayer *layer; 00234 00235 //! a full screen MMSFBWindow as buffer for all MMSRootWindow objects with own_surface=false 00236 static MMSFBWindow *fullscreen_root_window; 00237 00238 //! use count for fullscreen_root_window 00239 static int fullscreen_root_window_use_count; 00240 00241 //! a full screen MMSFBWindow as buffer for all MMSMainWindow objects with own_surface=false 00242 static MMSFBWindow *fullscreen_main_window; 00243 00244 //! use count for fullscreen_main_window 00245 static int fullscreen_main_window_use_count; 00246 00247 //! access to the MMSFBWindow which is behind of this class 00248 MMSFBWindow *window; 00249 00250 //! access to the MMSFBSurface of the window 00251 MMSFBSurface *surface; 00252 00253 //! visible screen area (that means the visible area e.g. on the TV set), see the initialization of the MMSWindowManager 00254 MMSFBRectangle vrect; 00255 00256 //! x-movement of the window based on the alignment attribute 00257 int dxpix; 00258 00259 //! y-movement of the window based on the alignment attribute 00260 int dypix; 00261 00262 //! geometry of the window based on the margin attribute 00263 MMSFBRectangle geom; 00264 00265 //! inner geometry of the window based on the border margin attribute 00266 MMSFBRectangle innerGeom; 00267 00268 //! check and recalc the geometry of the widgets during the next draw()? 00269 bool draw_setgeom; 00270 00271 //! widgets of the window 00272 vector<MMSWidget *> children; 00273 00274 //! focused widget or NULL 00275 MMSWidget *focusedwidget; 00276 00277 //! is window shown? 00278 bool shown; 00279 00280 //! is show animation running? 00281 bool willshow; 00282 00283 //! is hide animation running? 00284 bool willhide; 00285 00286 //! focus set the first time? 00287 bool firstfocusset; 00288 00289 //! child windows of the window 00290 vector<CHILDWINS> childwins; 00291 00292 //! focused child window 00293 unsigned int focusedChildWin; 00294 00295 //! widget which has to be selected if it is possible to navigate up 00296 MMSWidget *upArrowWidget; 00297 00298 //! widget which has to be selected if it is possible to navigate down 00299 MMSWidget *downArrowWidget; 00300 00301 //! widget which has to be selected if it is possible to navigate left 00302 MMSWidget *leftArrowWidget; 00303 00304 //! widget which has to be selected if it is possible to navigate right 00305 MMSWidget *rightArrowWidget; 00306 00307 //! up/down/left/right arrow widgets updated the first time? 00308 bool initialArrowsDrawn; 00309 00310 //! child window which is to be focused if user navigates up 00311 MMSWindow *navigateUpWindow; 00312 00313 //! child window which is to be focused if user navigates down 00314 MMSWindow *navigateDownWindow; 00315 00316 //! child window which is to be focused if user navigates left 00317 MMSWindow *navigateLeftWindow; 00318 00319 //! child window which is to be focused if user navigates right 00320 MMSWindow *navigateRightWindow; 00321 00322 //! widget on which the user has pressed the (mouse) button 00323 MMSWidget *buttonpress_widget; 00324 00325 //! child window on which the user has pressed the (mouse) button 00326 MMSWindow *buttonpress_childwin; 00327 00328 //! window will be stretched to the layer or the parent window using stretchBlit(), default is false 00329 bool stretchmode; 00330 00331 //! stretch the window to X percent of the window WIDTH to the left side 00332 //! the value is valid, if window is in stretch mode 00333 //! a value of 25600 means 100% (normal blit() will be used) 00334 int stretchLeft; 00335 00336 //! stretch the window to X percent of the window HEIGHT to the up side 00337 //! the value is valid, if window is in stretch mode 00338 //! a value of 25600 means 100% (normal blit() will be used) 00339 int stretchUp; 00340 00341 //! stretch the window to X percent of the window WIDTH to the right side 00342 //! the value is valid, if window is in stretch mode 00343 //! a value of 25600 means 100% (normal blit() will be used) 00344 int stretchRight; 00345 00346 //! stretch the window to X percent of the window HEIGHT to the down side 00347 //! the value is valid, if window is in stretch mode 00348 //! a value of 25600 means 100% (normal blit() will be used) 00349 int stretchDown; 00350 00351 00352 //! index in childwins vector for the first window with the always on top flag 00353 unsigned int always_on_top_index; 00354 00355 00356 //! Pulser for e.g. fade/move animations during show/hide 00357 MMSPulser pulser; 00358 00359 //! connection object for MMSPulser::onBeforeAnimation callback 00360 sigc::connection onBeforeAnimation_connection; 00361 00362 //! connection object for MMSPulser::onAnimation callback 00363 sigc::connection onAnimation_connection; 00364 00365 //! connection object for MMSPulser::onAfterAnimation callback 00366 sigc::connection onAfterAnimation_connection; 00367 00368 //! current pulser mode 00369 MMSWINDOW_PULSER_MODE pulser_mode; 00370 00371 00372 unsigned int anim_opacity; 00373 MMSFBRectangle anim_rect; 00374 bool anim_fade; 00375 MMSDIRECTION anim_move; 00376 unsigned int anim_opacity_step; 00377 int anim_move_step; 00378 00379 00380 bool need_redraw; 00381 00382 00383 //! Internal method: Creates the window. 00384 bool create(string dx, string dy, string w, string h, MMSALIGNMENT alignment, MMSWINDOW_FLAGS flags, 00385 bool *own_surface, bool *backbuffer); 00386 00387 //! Internal method: Creates the window. 00388 bool create(string w, string h, MMSALIGNMENT alignment, MMSWINDOW_FLAGS flags, 00389 bool *own_surface, bool *backbuffer); 00390 00391 //! Internal method: Resize the window. 00392 bool resize(bool refresh = true); 00393 00394 //! Internal method: Add a child window. 00395 bool addChildWindow(MMSWindow *childwin); 00396 00397 //! Internal method: Remove a child window. 00398 bool removeChildWindow(MMSWindow *childwin); 00399 00400 //! Internal method: Set the opacity of a child window. 00401 bool setChildWindowOpacity(MMSWindow *childwin, unsigned char opacity, bool refresh = true); 00402 00403 //! Internal method: Set the region of a child window. 00404 bool setChildWindowRegion(MMSWindow *childwin, bool refresh = true); 00405 00406 //! Internal method: Move a child window. 00407 bool moveChildWindow(MMSWindow *childwin, int x, int y, bool refresh = true); 00408 00409 //! Internal method: Draw a child window. 00410 void drawChildWindows(MMSFBSurface *dst_surface, MMSFBRegion *region = NULL, int offsX = 0, int offsY = 0); 00411 00412 //! Internal method: Flip a window. 00413 bool flipWindow(MMSWindow *win = NULL, MMSFBRegion *region = NULL, 00414 MMSFBFlipFlags flags = MMSFB_FLIP_NONE, 00415 bool flipChildSurface = true, bool locked = false); 00416 00417 //! Internal method: Remove the focus from a child window. 00418 void removeFocusFromChildWindow(); 00419 00420 //! Internal method: Load widgets for up/down/left/right arrows. 00421 void loadArrowWidgets(); 00422 00423 //! Internal method: Get the navigation status. With this infos we can select/unselect the arrow widgets. 00424 void getArrowWidgetStatus(ARROW_WIDGET_STATUS *setarrows); 00425 00426 //! Internal method: Update the status of the arrow widgets. 00427 void switchArrowWidgets(); 00428 00429 //! Internal method: Init navigation. 00430 bool initnav(); 00431 00432 //! Internal method: Load images and setup other things. 00433 virtual bool init(); 00434 00435 //! Internal method: Release images and other things. 00436 virtual bool release(); 00437 00438 //! Internal method: Draw me. 00439 virtual void draw(bool toRedrawOnly = false, MMSFBRectangle *rect2update = NULL, 00440 bool clear = true, unsigned char opacity = 255); 00441 00442 00443 //! tbd 00444 bool buffered_shown; 00445 00446 //! tbd 00447 void showBufferedShown(); 00448 00449 00450 //! Internal method: Draw my border. 00451 void drawMyBorder(unsigned char opacity = 255); 00452 00453 //! Internal method: Focus one widget/child window for the first time. 00454 bool setFirstFocus(bool cw = false); 00455 00456 //! Internal method: Used to find best candidate to navigate up from currPos. 00457 double calculateDistGradCode_Up(MMSFBRectangle currPos, MMSFBRectangle candPos); 00458 00459 //! Internal method: Used to find best candidate to navigate down from currPos. 00460 double calculateDistGradCode_Down(MMSFBRectangle currPos, MMSFBRectangle candPos); 00461 00462 //! Internal method: Used to find best candidate to navigate left from currPos. 00463 double calculateDistGradCode_Left(MMSFBRectangle currPos, MMSFBRectangle candPos); 00464 00465 //! Internal method: Used to find best candidate to navigate right from currPos. 00466 double calculateDistGradCode_Right(MMSFBRectangle currPos, MMSFBRectangle candPos); 00467 00468 //! Internal method: Handle widget navigation (up/down/left/right). 00469 bool handleNavigationForWidgets(MMSInputEvent *inputevent); 00470 00471 //! Internal method: Remove the focus from the currently focused child window. Goal: Change status of widgets. 00472 void removeChildWinFocus(); 00473 00474 //! Internal method: Restore the focus to the currently focused child window. Goal: Change status of widgets. 00475 bool restoreChildWinFocus(MMSInputEvent *inputevent = NULL); 00476 00477 //! Internal method: Handle child window navigation (up/down/left/right). 00478 bool handleNavigationForChildWins(MMSInputEvent *inputevent); 00479 00480 //! Internal method: Do the pre-calculation of the navigation routes. 00481 void preCalcNavigation(); 00482 00483 //! Internal method: Lock the window. Will be used by the widgets. 00484 void lock(); 00485 00486 //! Internal method: Unlock the window. Will be used by the widgets. 00487 void unlock(); 00488 00489 bool onBeforeAnimation(MMSPulser *pulser); 00490 bool onAnimation(MMSPulser *pulser); 00491 void onAfterAnimation(MMSPulser *pulser); 00492 00493 virtual bool beforeShowAction(MMSPulser *pulser); 00494 virtual bool showAction(MMSPulser *pulser); 00495 virtual void afterShowAction(MMSPulser *pulser); 00496 00497 virtual bool beforeHideAction(MMSPulser *pulser); 00498 virtual bool hideAction(MMSPulser *pulser); 00499 virtual void afterHideAction(MMSPulser *pulser); 00500 00501 00502 //! Internal method: Will be called from the MMSWindowAction thread if the window should disappear. 00503 // virtual bool hideAction(bool *stopaction); 00504 00505 //! Internal method: Refresh a part of a window. Will be used by the widgets. 00506 void refreshFromChild(MMSWidget *child, MMSFBRectangle *rect2update = NULL, bool check_shown = true); 00507 00508 //! Internal method: Set the focused widget. 00509 void setFocusedWidget(MMSWidget *child, bool set, bool switchfocus = false, bool refresh = true); 00510 00511 //! Internal method: Will be called by MMSInputManager if the window has the input focus. 00512 bool handleInput(MMSInputEvent *inputevent); 00513 00514 //! Internal method: (Re-)calculate the position and size of all widgets. 00515 void recalculateChildren(); 00516 00517 //! Internal method: Show the window without animation. 00518 void instantShow(); 00519 00520 //! Internal method: Hide the window without animation. 00521 void instantHide(); 00522 00523 //! Internal method: Give window a recalculation hint used for next draw(). 00524 void setWidgetGeometryOnNextDraw(); 00525 00526 //! Internal method: Inform the window, that the language has changed. 00527 void targetLangChanged(MMSLanguage lang, bool refresh = true); 00528 00529 //! Internal method: Inform the window, that the theme has changed. 00530 void themeChanged(string &themeName, bool refresh = true); 00531 00532 protected: 00533 00534 //! interface to the window manager 00535 static class IMMSWindowManager *windowmanager; 00536 00537 public: 00538 00539 //! The base constructor for all window types. 00540 /*! This will internally used by the supported window types/classes (see MMSWINDOWTYPE). 00541 */ 00542 MMSWindow(); 00543 00544 //! The base destructor for this class. 00545 virtual ~MMSWindow(); 00546 00547 //! Get the type of the window. 00548 /*! 00549 \return type of the window 00550 */ 00551 MMSWINDOWTYPE getType(); 00552 00553 //! Get the name of the window. 00554 /*! 00555 \return name of the window 00556 */ 00557 string getName(); 00558 00559 //! Set the name of the window. 00560 /*! 00561 \param name name of the window 00562 */ 00563 void setName(string name); 00564 00565 //! Find a window over its name. 00566 /*! 00567 \param name name of the window 00568 \return pointer to the MMSWindow object or NULL 00569 */ 00570 MMSWindow* findWindow(string name); 00571 00572 //! Return last window in the stack. 00573 /*! 00574 \return pointer to the MMSWindow object or NULL 00575 */ 00576 MMSWindow* getLastWindow(); 00577 00578 //! Makes a window visible. 00579 /*! 00580 \return true if the show action successfully started 00581 \note The MMSWindowAction thread will be started here and show() returnes immediately! 00582 */ 00583 virtual bool show(); 00584 00585 //! Hide a visible window. 00586 /*! 00587 \param goback this parameter will be routed to the onHide callback, so the application can 00588 decide which if and which window should appear afterwards 00589 \param wait waiting until hideAction is finished? 00590 \return true if the hide action successfully started 00591 \note The MMSWindowAction thread will be started here and hide() returnes immediately if wait=false! 00592 */ 00593 virtual bool hide(bool goback = false, bool wait = false); 00594 00595 //! Can be called after show() waiting for end of showAction thread. 00596 void waitUntilShown(); 00597 00598 //! Can be called after hide() waiting for end of hideAction thread. 00599 void waitUntilHidden(); 00600 00601 //! Get the geometry of the window. 00602 /*! 00603 \return the rectangle of the window on the layer or parent window 00604 */ 00605 MMSFBRectangle getGeometry(); 00606 00607 //! Get the geometry of the window based on the layer. 00608 /*! 00609 \return the rectangle of the window on the layer 00610 */ 00611 MMSFBRectangle getRealGeometry(); 00612 00613 //! Add a widget to the window. 00614 /*! 00615 \param child pointer to a widget 00616 */ 00617 void add(MMSWidget *child); 00618 00619 //! Remove a widget from the window. 00620 /*! 00621 \param child pointer to a widget 00622 */ 00623 void remove(MMSWidget *child); 00624 00625 //! Get the currently focused widget. 00626 /*! 00627 \return pointer to the focused widget 00628 */ 00629 MMSWidget *getFocusedWidget(); 00630 00631 //! Get the number of focusable widgets. 00632 /*! 00633 \param cw go recursive through child windows if set to true 00634 \return number of focusable widgets 00635 */ 00636 int getNumberOfFocusableWidgets(bool cw = false); 00637 00638 //! Get the number of focusable child windows. 00639 /*! 00640 \return number of focusable child windows 00641 */ 00642 int getNumberOfFocusableChildWins(); 00643 00644 //! Refresh (redraw) the whole window or a part of it. 00645 /*! 00646 It is possible to update window attributes without refresh. 00647 In this case you have to refresh() the window 'manually' to make the changes visible. 00648 \param region region of the window which is to refresh, default NULL means the whole window 00649 00650 For example you can call: 00651 00652 a) setOpacity(100) and setBgColor(bgcolor) 00653 00654 or 00655 00656 b) setOpacity(100, false), setBgColor(bgcolor, false) and then refresh() 00657 00658 With variant b) you have a better performance because only one refresh will be done. 00659 00660 This works also for widgets. You can update a few widgets without direct refresh 00661 and call window->refresh() afterwards. 00662 */ 00663 void refresh(MMSFBRegion *region = NULL); 00664 00665 //! Flip the surface of the window to make changes visible. 00666 /*! 00667 \return true if successfully flipped 00668 \note You have to call this method ONLY, if you are drawing own things direct on the window surface! 00669 \note Please do NOT use this method within the 'normal' GUI context! There is NO need! 00670 \note If you want to flip, you can also use the flip() method of the MMSFBSurface. But this window flip method handles also childwindows. 00671 */ 00672 bool flip(void); 00673 00674 //! Get access to the layer of the window. 00675 /*! 00676 \return pointer to the MMSFBLayer object 00677 */ 00678 MMSFBLayer *getLayer(); 00679 00680 //! Get access to the surface of the window needed to display video streams. 00681 /*! 00682 \return pointer to the surface class 00683 */ 00684 MMSFBSurface *getSurface(); 00685 00686 //! Get the parent window. 00687 /*! 00688 \param toplevel if true the toplevel parent will be returned 00689 \return pointer to the parent window or NULL if the window has no parent 00690 */ 00691 MMSWindow *getParent(bool toplevel = false); 00692 00693 //! Set the window manager. 00694 /*! 00695 \param wm interface to the window manager 00696 */ 00697 void setWindowManager(IMMSWindowManager *wm); 00698 00699 //! Is the window shown? 00700 /*! 00701 \param checkparents if true the parent(s) will be check too 00702 \param checkopacity if true the opacity of window(s) will be check too 00703 \return true, if the window is shown 00704 */ 00705 bool isShown(bool checkparents = false, bool checkopacity = false); 00706 00707 //! Is the hide action running? 00708 /*! 00709 \return true, if the window action thread is going to hide the window 00710 */ 00711 bool willHide(); 00712 00713 //! Set the focus to this window. 00714 void setFocus(); 00715 00716 //! Is the window focused? 00717 /*! 00718 \param checkparents if true the parent(s) will be check too 00719 \return true, if the window is focused 00720 */ 00721 bool getFocus(bool checkparents = false); 00722 00723 //! Find a widget with a given name. 00724 /*! 00725 \param name name of the widget 00726 \return pointer to the widget which was found or NULL 00727 */ 00728 MMSWidget* findWidget(string name); 00729 00730 //! Find a widget with a given type. 00731 /*! 00732 \param type type of the widget 00733 \return pointer to the widget which was found or NULL 00734 */ 00735 MMSWidget* findWidgetType(MMSWIDGETTYPE type); 00736 00737 //! Find a widget with a given name and type. 00738 /*! 00739 Find a root widget with the given name. If the found widget has not the 00740 given type, then it searches for the given type under the root widget node. 00741 \param name name of the widget 00742 \param type type of the widget 00743 \return pointer to the widget which was found or NULL 00744 */ 00745 MMSWidget* findWidgetAndType(string name, MMSWIDGETTYPE type); 00746 00747 //! Operator [] which you can use to find a widget. 00748 /*! 00749 \param name name of the widget 00750 \return pointer to the widget which was found or NULL 00751 \see findWidget() 00752 */ 00753 MMSWidget* operator[](string name); 00754 00755 //! Get the window to which the GUI navigates if the user press up. 00756 /*! 00757 \return pointer to the window or NULL 00758 */ 00759 MMSWindow *getNavigateUpWindow(); 00760 00761 //! Get the window to which the GUI navigates if the user press down. 00762 /*! 00763 \return pointer to the window or NULL 00764 */ 00765 MMSWindow *getNavigateDownWindow(); 00766 00767 //! Get the window to which the GUI navigates if the user press left. 00768 /*! 00769 \return pointer to the window or NULL 00770 */ 00771 MMSWindow *getNavigateLeftWindow(); 00772 00773 //! Get the window to which the GUI navigates if the user press right. 00774 /*! 00775 \return pointer to the window or NULL 00776 */ 00777 MMSWindow *getNavigateRightWindow(); 00778 00779 //! Set the window to which the GUI navigates if the user press up. 00780 /*! 00781 \param upWindow pointer to the window or NULL 00782 */ 00783 void setNavigateUpWindow(MMSWindow *upWindow); 00784 00785 //! Set the window to which the GUI navigates if the user press down. 00786 /*! 00787 \param downWindow pointer to the window or NULL 00788 */ 00789 void setNavigateDownWindow(MMSWindow *downWindow); 00790 00791 //! Set the window to which the GUI navigates if the user press left. 00792 /*! 00793 \param leftWindow pointer to the window or NULL 00794 */ 00795 void setNavigateLeftWindow(MMSWindow *leftWindow); 00796 00797 //! Set the window to which the GUI navigates if the user press right. 00798 /*! 00799 \param rightWindow pointer to the window or NULL 00800 */ 00801 void setNavigateRightWindow(MMSWindow *rightWindow); 00802 00803 00804 00805 bool raiseToTop(int zlevel = 0); 00806 bool lowerToBottom(); 00807 00808 bool moveTo(int x, int y, bool refresh = true); 00809 00810 00811 00812 00813 //! Stretch the window to the layer or the parent window using stretchBlit(). 00814 /*! 00815 \param left stretch the window to X percent of the window WIDTH to the left side, 00816 a value of 100 means 100% 00817 \param up stretch the window to X percent of the window HEIGHT to the up side, 00818 a value of 100 means 100% 00819 \param right stretch the window to X percent of the window WIDTH to the right side, 00820 a value of 100 means 100% 00821 \param down stretch the window to X percent of the window HEIGHT to the down side, 00822 a value of 100 means 100% 00823 \return true, if the values are accepted 00824 \note Call stretch() or stretch(100, 100, 100, 100) to switch-of the stretch mode. 00825 \note The formulas (((left-100)+(right-100)+100) > 0) and (((up-100)+(down-100)+100) > 0) 00826 need to be met! Else nothing is to be displayed! 00827 \note This function was implemented to get cool effects. If you display windows permanently in 00828 stretch mode the performance will be drastically decreased. 00829 */ 00830 bool stretch(double left = 100, double up = 100, double right = 100, double down = 100); 00831 00832 00833 00834 //! Set one or more callbacks for the onBeforeShow event. 00835 /*! 00836 The connected callbacks will be called during show(). 00837 If at least one of the callbacks returns false, the show process of the window 00838 will be stopped and the window will not appear. 00839 00840 A callback method must be defined like this: 00841 00842 bool myclass::mycallbackmethod(MMSWindow *win); 00843 00844 \param win is the pointer to the window which is to be shown 00845 00846 \return true if the show process should continue, else false if the window should not appear 00847 00848 To connect your callback to onBeforeShow do this: 00849 00850 sigc::connection connection; 00851 connection = mywindow->onBeforeShow->connect(sigc::mem_fun(myobject,&myclass::mycallbackmethod)); 00852 00853 To disconnect your callback do this: 00854 00855 connection.disconnect(); 00856 00857 Please note: 00858 00859 You HAVE TO disconnect myobject from onBeforeShow BEFORE myobject will be deleted!!! 00860 Else an abnormal program termination can occur. 00861 You HAVE TO call the disconnect() method of sigc::connection explicitly. The destructor will NOT do this!!! 00862 */ 00863 sigc::signal<bool, MMSWindow*>::accumulated<bool_accumulator> *onBeforeShow; 00864 00865 //! Set one or more callbacks for the onAfterShow event. 00866 /*! 00867 The connected callbacks will be called during show(). 00868 00869 A callback method must be defined like this: 00870 00871 void myclass::mycallbackmethod(MMSWindow *win, bool already_shown); 00872 00873 \param win is the pointer to the window which is shown now 00874 \param already_shown the window was already shown? 00875 00876 To connect your callback to onAfterShow do this: 00877 00878 sigc::connection connection; 00879 connection = mywindow->onAfterShow->connect(sigc::mem_fun(myobject,&myclass::mycallbackmethod)); 00880 00881 To disconnect your callback do this: 00882 00883 connection.disconnect(); 00884 00885 Please note: 00886 00887 You HAVE TO disconnect myobject from onAfterShow BEFORE myobject will be deleted!!! 00888 Else an abnormal program termination can occur. 00889 You HAVE TO call the disconnect() method of sigc::connection explicitly. The destructor will NOT do this!!! 00890 */ 00891 sigc::signal<void, MMSWindow*, bool> *onAfterShow; 00892 00893 //! Set one or more callbacks for the onBeforeHide event. 00894 /*! 00895 The connected callbacks will be called during hide(). 00896 If at least one of the callbacks returns false, the hide process of the window 00897 will be stopped and the window will not disappear. 00898 00899 A callback method must be defined like this: 00900 00901 bool myclass::mycallbackmethod(MMSWindow *win, bool goback); 00902 00903 \param win is the pointer to the window which is to be hidden 00904 \param goback the application can decide, what to do if true/false, see hide() 00905 00906 \return true if the hide process should continue, else false if the window should not disappear 00907 00908 To connect your callback to onBeforeHide do this: 00909 00910 sigc::connection connection; 00911 connection = mywindow->onBeforeHide->connect(sigc::mem_fun(myobject,&myclass::mycallbackmethod)); 00912 00913 To disconnect your callback do this: 00914 00915 connection.disconnect(); 00916 00917 Please note: 00918 00919 You HAVE TO disconnect myobject from onBeforeHide BEFORE myobject will be deleted!!! 00920 Else an abnormal program termination can occur. 00921 You HAVE TO call the disconnect() method of sigc::connection explicitly. The destructor will NOT do this!!! 00922 */ 00923 sigc::signal<bool, MMSWindow*, bool>::accumulated<bool_accumulator> *onBeforeHide; 00924 00925 //! Set one or more callbacks for the onHide event. 00926 /*! 00927 The connected callbacks will be called during hide(). 00928 00929 A callback method must be defined like this: 00930 00931 void myclass::mycallbackmethod(MMSWindow *win, bool goback); 00932 00933 \param win is the pointer to the window which is hidden now 00934 \param goback the application can decide, what to do if true/false, see hide() 00935 00936 To connect your callback to onHide do this: 00937 00938 sigc::connection connection; 00939 connection = mywindow->onHide->connect(sigc::mem_fun(myobject,&myclass::mycallbackmethod)); 00940 00941 To disconnect your callback do this: 00942 00943 connection.disconnect(); 00944 00945 Please note: 00946 00947 You HAVE TO disconnect myobject from onHide BEFORE myobject will be deleted!!! 00948 Else an abnormal program termination can occur. 00949 You HAVE TO call the disconnect() method of sigc::connection explicitly. The destructor will NOT do this!!! 00950 */ 00951 sigc::signal<void, MMSWindow*, bool> *onHide; 00952 00953 //! Set one or more callbacks for the onHandleInput event. 00954 /*! 00955 The connected callbacks will be called if an input event was raised. 00956 00957 A callback method must be defined like this: 00958 00959 bool myclass::mycallbackmethod(MMSWindow *win, MMSInputEvent *inputevent); 00960 00961 \param win is the pointer to the window 00962 \param inputevent the input event 00963 00964 \return callback should return true if the input was handled, else false 00965 00966 To connect your callback to onHandleInput do this: 00967 00968 sigc::connection connection; 00969 connection = mywindow->onHandleInput->connect(sigc::mem_fun(myobject,&myclass::mycallbackmethod)); 00970 00971 To disconnect your callback do this: 00972 00973 connection.disconnect(); 00974 00975 Please note: 00976 00977 You HAVE TO disconnect myobject from onHandleInput BEFORE myobject will be deleted!!! 00978 Else an abnormal program termination can occur. 00979 You HAVE TO call the disconnect() method of sigc::connection explicitly. The destructor will NOT do this!!! 00980 */ 00981 sigc::signal<bool, MMSWindow*, MMSInputEvent*>::accumulated<neg_bool_accumulator> *onHandleInput; 00982 00983 //! Set one or more callbacks for the onBeforeHandleInput event. 00984 /*! 00985 The connected callbacks will be called if an input event was raised, before any standard operation took place 00986 00987 A callback method must be defined like this: 00988 00989 bool myclass::mycallbackmethod(MMSWindow *win, MMSInputEvent *inputevent); 00990 00991 \param win is the pointer to the window 00992 \param inputevent the input event 00993 00994 \return callback should return true if the input was handled, else false 00995 00996 To connect your callback to onHandleInput do this: 00997 00998 sigc::connection connection; 00999 connection = mywindow->onHandleInput->connect(sigc::mem_fun(myobject,&myclass::mycallbackmethod)); 01000 01001 To disconnect your callback do this: 01002 01003 connection.disconnect(); 01004 01005 Please note: 01006 01007 You HAVE TO disconnect myobject from onHandleInput BEFORE myobject will be deleted!!! 01008 Else an abnormal program termination can occur. 01009 You HAVE TO call the disconnect() method of sigc::connection explicitly. The destructor will NOT do this!!! 01010 */ 01011 sigc::signal<bool, MMSWindow*, MMSInputEvent*>::accumulated<neg_bool_accumulator> *onBeforeHandleInput; 01012 01013 01014 //! Set one or more callbacks for the onDraw event. 01015 /*! 01016 The connected callbacks will be called if the window will be drawn. 01017 01018 A callback method must be defined like this: 01019 01020 bool myclass::mycallbackmethod(MMSFBSurface *surface, bool clear); 01021 01022 \param surface is the pointer to window's surface 01023 \param clear if true, the callback should clear the surface before drawing 01024 01025 \return callback should return true if it has drawn to the surface, else false 01026 01027 To connect your callback to onDraw do this: 01028 01029 sigc::connection connection; 01030 connection = mywindow->onDraw->connect(sigc::mem_fun(myobject,&myclass::mycallbackmethod)); 01031 01032 To disconnect your callback do this: 01033 01034 connection.disconnect(); 01035 01036 Please note: 01037 01038 You HAVE TO disconnect myobject from onDraw BEFORE myobject will be deleted!!! 01039 Else an abnormal program termination can occur. 01040 You HAVE TO call the disconnect() method of sigc::connection explicitly. The destructor will NOT do this!!! 01041 */ 01042 sigc::signal<bool, MMSFBSurface*, bool>::accumulated<neg_bool_accumulator> *onDraw; 01043 01044 01045 01046 01047 01048 01049 01050 01051 unsigned int printStack(char *buffer, int space = 0); 01052 01053 public: 01054 /* begin of theme access methods *************************************/ 01055 01056 //! Get the alignment of the window. 01057 /*! 01058 \param alignment returns the alignment 01059 \return true, if alignment is successfully returned 01060 */ 01061 bool getAlignment(MMSALIGNMENT &alignment); 01062 01063 //! Get the x-movement of the window. 01064 /*! 01065 \param dx returns the x-movement 01066 \return true, if dx is successfully returned 01067 */ 01068 bool getDx(string &dx); 01069 01070 //! Get the x-movement of the window as integer in pixel. 01071 /*! 01072 \return the x-movement 01073 */ 01074 int getDxPix(); 01075 01076 //! Get the y-movement of the window. 01077 /*! 01078 \param dy returns the y-movement 01079 \return true, if dy is successfully returned 01080 */ 01081 bool getDy(string &dy); 01082 01083 //! Get the y-movement of the window as integer in pixel. 01084 /*! 01085 \return the y-movement 01086 */ 01087 int getDyPix(); 01088 01089 //! Get the width of the window. 01090 /*! 01091 \param width returns the width 01092 \return true, if width is successfully returned 01093 */ 01094 bool getWidth(string &width); 01095 01096 //! Get the height of the window. 01097 /*! 01098 \param height returns the height 01099 \return true, if height is successfully returned 01100 */ 01101 bool getHeight(string &height); 01102 01103 //! Get the background color of the window. 01104 /*! 01105 \param bgcolor returns the bgcolor 01106 \return true, if bgcolor is successfully returned 01107 */ 01108 bool getBgColor(MMSFBColor &bgcolor); 01109 01110 //! Get the path to the background image of the window. 01111 /*! 01112 \param bgimagepath returns the path 01113 \return true, if bgimagepath is successfully returned 01114 */ 01115 bool getBgImagePath(string &bgimagepath); 01116 01117 //! Get the name of the background image. 01118 /*! 01119 \param bgimagename returns the name 01120 \return true, if bgimagename is successfully returned 01121 */ 01122 bool getBgImageName(string &bgimagename); 01123 01124 //! Get the opacity of the window. 01125 /*! 01126 \param opacity returns the opacity 01127 \return true, if opacity is successfully returned 01128 */ 01129 bool getOpacity(unsigned int &opacity); 01130 01131 //! Detect if the window has to fade-in during the show action. 01132 /*! 01133 \param fadein returns the fadein status 01134 \return true, if fadein is successfully returned 01135 */ 01136 bool getFadeIn(bool &fadein); 01137 01138 //! Detect if the window has to fade-out during the hide action. 01139 /*! 01140 \param fadeout returns the fadeout status 01141 \return true, if fadeout is successfully returned 01142 */ 01143 bool getFadeOut(bool &fadeout); 01144 01145 //! Detect if the window has to draw debug rectangles around its widgets. 01146 /*! 01147 \param debug returns the debug status 01148 \return true, if debug is successfully returned 01149 */ 01150 bool getDebug(bool &debug); 01151 01152 //! Get the margin of the window. 01153 /*! 01154 The margin of a window is the space around the window border. 01155 If you have for example a 640x480 window with an margin 10, the window content will be drawed within 620x460. 01156 \param margin returns the margin 01157 \return true, if margin is successfully returned 01158 */ 01159 bool getMargin(unsigned int &margin); 01160 01161 //! Get the name of the uparrow widget. 01162 /*! 01163 If the user can navigate up to a other widget or child window, 01164 the uparrow widget will be selected, else unselected. 01165 \param uparrow returns the name 01166 \return true, if uparrow is successfully returned 01167 */ 01168 bool getUpArrow(string &uparrow); 01169 01170 //! Get the name of the downarrow widget. 01171 /*! 01172 If the user can navigate down to a other widget or child window, 01173 the downarrow widget will be selected, else unselected. 01174 \param downarrow returns the name 01175 \return true, if downarrow is successfully returned 01176 */ 01177 bool getDownArrow(string &downarrow); 01178 01179 //! Get the name of the leftarrow widget. 01180 /*! 01181 If the user can navigate left to a other widget or child window, 01182 the leftarrow widget will be selected, else unselected. 01183 \param leftarrow returns the name 01184 \return true, if leftarrow is successfully returned 01185 */ 01186 bool getLeftArrow(string &leftarrow); 01187 01188 //! Get the name of the rightarrow widget. 01189 /*! 01190 If the user can navigate right to a other widget or child window, 01191 the rightarrow widget will be selected, else unselected. 01192 \param rightarrow returns the name 01193 \return true, if rightarrow is successfully returned 01194 */ 01195 bool getRightArrow(string &rightarrow); 01196 01197 //! Get the name of the navigateup window. 01198 /*! 01199 This is the child window which is to be focused if user navigates up. 01200 If it is not set, the GUI is searching automatically for the best route. 01201 \param navigateup returns the name 01202 \return true, if navigateup is successfully returned 01203 */ 01204 bool getNavigateUp(string &navigateup); 01205 01206 //! Get the name of the navigatedown window. 01207 /*! 01208 This is the child window which is to be focused if user navigates down. 01209 If it is not set, the GUI is searching automatically for the best route. 01210 \param navigatedown returns the name 01211 \return true, if navigatedown is successfully returned 01212 */ 01213 bool getNavigateDown(string &navigatedown); 01214 01215 //! Get the name of the navigateleft window. 01216 /*! 01217 This is the child window which is to be focused if user navigates left. 01218 If it is not set, the GUI is searching automatically for the best route. 01219 \param navigateleft returns the name 01220 \return true, if navigateleft is successfully returned 01221 */ 01222 bool getNavigateLeft(string &navigateleft); 01223 01224 //! Get the name of the navigateright window. 01225 /*! 01226 This is the child window which is to be focused if user navigates right. 01227 If it is not set, the GUI is searching automatically for the best route. 01228 \param navigateright returns the name 01229 \return true, if navigateright is successfully returned 01230 */ 01231 bool getNavigateRight(string &navigateright); 01232 01233 //! Detect if the window has an own surface. 01234 /*! 01235 If the window has no own surface, the drawing functions will be directly work on the parent surface. 01236 This can save a lot of memory. 01237 \param ownsurface returns the ownsurface status 01238 \return true, if ownsurface is successfully returned 01239 */ 01240 bool getOwnSurface(bool &ownsurface); 01241 01242 //! Get the move-in direction of the window which is used during the show action. 01243 /*! 01244 \param movein returns the movein direction 01245 \return true, if movein is successfully returned 01246 */ 01247 bool getMoveIn(MMSDIRECTION &movein); 01248 01249 //! Get the move-out direction of the window which is used during the hide action. 01250 /*! 01251 \param moveout returns the moveout direction 01252 \return true, if moveout is successfully returned 01253 */ 01254 bool getMoveOut(MMSDIRECTION &moveout); 01255 01256 //! Detect if the window has to be modal if it is focused. 01257 /*! 01258 \param modal returns the modal status 01259 \return true, if modal is successfully returned 01260 */ 01261 bool getModal(bool &modal); 01262 01263 //! Detect if the window automatically changes the zorder of child windows during show() or setFocus() 01264 /*! 01265 \param staticzorder returns the static zorder flag 01266 \return true, if value is successfully returned 01267 */ 01268 bool getStaticZOrder(bool &staticzorder); 01269 01270 //! Detect if the window will be permanently displayed at the top of the window stack. 01271 /*! 01272 \param alwaysontop returns the always on top flag 01273 \return true, if value is successfully returned 01274 */ 01275 bool getAlwaysOnTop(bool &alwaysontop); 01276 01277 //! Detect if the window can be focused. 01278 /*! 01279 \param focusable returns the focusable flag 01280 \return true, if value is successfully returned 01281 */ 01282 bool getFocusable(bool &focusable); 01283 01284 //! Detect if the window has an backbuffer. 01285 /*! 01286 \param backbuffer returns the backbuffer flag 01287 \return true, if value is successfully returned 01288 */ 01289 bool getBackBuffer(bool &backbuffer); 01290 01291 //! Detect if the window is loading images, fonts etc. during initialization. 01292 /*! 01293 \param initialload returns the initial load flag 01294 \return true, if value is successfully returned 01295 \note Per default initial load is false. That means that the window and it's widgets 01296 will load images, fonts etc. during the first show(). 01297 */ 01298 bool getInitialLoad(bool &initialload); 01299 01300 //! Get the color of the window border. 01301 /*! 01302 \param color returns the border color 01303 \return true, if color is successfully returned 01304 */ 01305 bool getBorderColor(MMSFBColor &color); 01306 01307 //! Get the path to the window border images. 01308 /*! 01309 \param imagepath returns the path 01310 \return true, if imagepath is successfully returned 01311 */ 01312 bool getBorderImagePath(string &imagepath); 01313 01314 //! Get the name of a border image. 01315 /*! 01316 \param num number of image, see MMSBORDER_IMAGE_NUM 01317 \param imagename returns the name 01318 \return true, if imagename is successfully returned 01319 */ 01320 bool getBorderImageNames(MMSBORDER_IMAGE_NUM num, string &imagename); 01321 01322 //! Get the border thickness. 01323 /*! 01324 \param thickness returns the border thickness 01325 \return true, if thickness is successfully returned 01326 */ 01327 bool getBorderThickness(unsigned int &thickness); 01328 01329 //! Get the border margin. 01330 /*! 01331 The border margin is the space between the border an the inner rectangle of the window on which the 01332 widgets or child windows will be drawn. 01333 \param margin returns the border margin 01334 \return true, if margin is successfully returned 01335 */ 01336 bool getBorderMargin(unsigned int &margin); 01337 01338 //! Detect if the border has round corners. 01339 /*! 01340 \param rcorners returns the round corners status 01341 \return true, if rcorners is successfully returned 01342 */ 01343 bool getBorderRCorners(bool &rcorners); 01344 01345 01346 //! Set the alignment of the window. 01347 /*! 01348 \param alignment the alignment 01349 \param refresh refresh the window after changing the alignment? 01350 \param resize resize the window after changing the alignment? 01351 */ 01352 void setAlignment(MMSALIGNMENT alignment, bool refresh = true, bool resize = true); 01353 01354 //! Set the x-movement of the window. 01355 /*! 01356 \param dx the x-movement 01357 \param refresh refresh the window after changing the dx? 01358 \param resize resize the window after changing the dx? 01359 */ 01360 void setDx(string dx, bool refresh = false, bool resize = true); 01361 01362 //! Set the x-movement of the window as integer in pixel. 01363 /*! 01364 \param dx the x-movement in pixel 01365 \param refresh refresh the window after changing the dx? 01366 \param resize resize the window after changing the dx? 01367 */ 01368 void setDxPix(int dx, bool refresh = false, bool resize = true); 01369 01370 //! Set the y-movement of the window. 01371 /*! 01372 \param dy the y-movement 01373 \param refresh refresh the window after changing the dy? 01374 \param resize resize the window after changing the dy? 01375 */ 01376 void setDy(string dy, bool refresh = false, bool resize = true); 01377 01378 //! Set the y-movement of the window as integer in pixel. 01379 /*! 01380 \param dy the y-movement in pixel 01381 \param refresh refresh the window after changing the dy? 01382 \param resize resize the window after changing the dy? 01383 */ 01384 void setDyPix(int dy, bool refresh = false, bool resize = true); 01385 01386 //! Set the width of the window. 01387 /*! 01388 \param width the width 01389 \param refresh refresh the window after changing the width? 01390 \param resize resize the window after changing the width? 01391 */ 01392 void setWidth(string width, bool refresh = true, bool resize = true); 01393 01394 //! Set the height of the window. 01395 /*! 01396 \param height the height 01397 \param refresh refresh the window after changing the height? 01398 \param resize resize the window after changing the height? 01399 */ 01400 void setHeight(string height, bool refresh = true, bool resize = true); 01401 01402 //! Set the background color of the window. 01403 /*! 01404 \param bgcolor the bgcolor 01405 \param refresh refresh the window after changing the bgcolor? 01406 */ 01407 void setBgColor(MMSFBColor bgcolor, bool refresh = true); 01408 01409 //! Set the path to the background image of the window. 01410 /*! 01411 \param bgimagepath the path 01412 \param load reload the bgimage after changing the bgimagepath? 01413 \param refresh refresh the window after changing the bgimagepath? 01414 */ 01415 void setBgImagePath(string bgimagepath, bool load = true, bool refresh = true); 01416 01417 //! Set the name of the background image. 01418 /*! 01419 \param bgimagename the name 01420 \param load reload the bgimage after changing the bgimagename? 01421 \param refresh refresh the window after changing the bgimagename? 01422 */ 01423 void setBgImageName(string bgimagename, bool load = true, bool refresh = true); 01424 01425 //! Set background image already loaded by the application 01426 /*! 01427 \param bgimage pointer to surface or NULL 01428 \param refresh refresh the window after changing? 01429 */ 01430 void setBgImage(MMSFBSurface *bgimage, bool refresh = true); 01431 01432 //! Set the opacity of the window. 01433 /*! 01434 \param opacity the opacity 01435 \param refresh refresh the window after changing the opacity? 01436 */ 01437 void setOpacity(unsigned int opacity, bool refresh = true); 01438 01439 //! Set the fadein status needed during the show action. 01440 /*! 01441 \param fadein if true, the window is fading in during the next show() 01442 */ 01443 void setFadeIn(bool fadein); 01444 01445 //! Set the fadeout status needed during the hide action. 01446 /*! 01447 \param fadeout if true, the window is fading out during the next hide() 01448 */ 01449 void setFadeOut(bool fadeout); 01450 01451 //! Should the window draw debug rectangles around its widgets? 01452 /*! 01453 \param debug the debug status 01454 \param refresh refresh the window after changing the debug status? 01455 */ 01456 void setDebug(bool debug, bool refresh = true); 01457 01458 //! Set the margin of the window. 01459 /*! 01460 The margin of a window is the space around the window border. 01461 If you have for example a 640x480 window with an margin 10, the window content will be drawed within 620x460. 01462 \param margin the margin 01463 \param refresh refresh the window after changing the margin? 01464 \param resize resize the window after changing the margin? 01465 */ 01466 void setMargin(unsigned int margin, bool refresh = true, bool resize = true); 01467 01468 //! Set the name of the uparrow widget. 01469 /*! 01470 If the user can navigate up to a other widget or child window, 01471 the uparrow widget will be selected, else unselected. 01472 \param uparrow the name 01473 \param refresh refresh the window after changing the uparrow? 01474 */ 01475 void setUpArrow(string uparrow, bool refresh = true); 01476 01477 //! Set the name of the downarrow widget. 01478 /*! 01479 If the user can navigate down to a other widget or child window, 01480 the downarrow widget will be selected, else unselected. 01481 \param downarrow the name 01482 \param refresh refresh the window after changing the downarrow? 01483 */ 01484 void setDownArrow(string downarrow, bool refresh = true); 01485 01486 //! Set the name of the leftarrow widget. 01487 /*! 01488 If the user can navigate left to a other widget or child window, 01489 the leftarrow widget will be selected, else unselected. 01490 \param leftarrow the name 01491 \param refresh refresh the window after changing the leftarrow? 01492 */ 01493 void setLeftArrow(string leftarrow, bool refresh = true); 01494 01495 //! Set the name of the rightarrow widget. 01496 /*! 01497 If the user can navigate right to a other widget or child window, 01498 the rightarrow widget will be selected, else unselected. 01499 \param rightarrow the name 01500 \param refresh refresh the window after changing the rightarrow? 01501 */ 01502 void setRightArrow(string rightarrow, bool refresh = true); 01503 01504 //! Set the name of the navigateup window. 01505 /*! 01506 This is the child window which is to be focused if user navigates up. 01507 If it is not set, the GUI is searching automatically for the best route. 01508 \param navigateup the name 01509 */ 01510 void setNavigateUp(string navigateup); 01511 01512 //! Set the name of the navigatedown window. 01513 /*! 01514 This is the child window which is to be focused if user navigates down. 01515 If it is not set, the GUI is searching automatically for the best route. 01516 \param navigatedown the name 01517 */ 01518 void setNavigateDown(string navigatedown); 01519 01520 //! Set the name of the navigateleft window. 01521 /*! 01522 This is the child window which is to be focused if user navigates left. 01523 If it is not set, the GUI is searching automatically for the best route. 01524 \param navigateleft the name 01525 */ 01526 void setNavigateLeft(string navigateleft); 01527 01528 //! Set the name of the navigateright window. 01529 /*! 01530 This is the child window which is to be focused if user navigates right. 01531 If it is not set, the GUI is searching automatically for the best route. 01532 \param navigateright the name 01533 */ 01534 void setNavigateRight(string navigateright); 01535 01536 //! Should the window working with an own surface? 01537 /*! 01538 If the window has no own surface, the drawing functions will be directly work on the parent surface. 01539 This can save a lot of memory. 01540 \param ownsurface the ownsurface status 01541 */ 01542 void setOwnSurface(bool ownsurface); 01543 01544 //! Set the move-in direction of the window which is used during the show action. 01545 /*! 01546 \param movein the movein direction 01547 */ 01548 void setMoveIn(MMSDIRECTION movein); 01549 01550 //! Set the move-out direction of the window which is used during the hide action. 01551 /*! 01552 \param moveout the moveout direction 01553 */ 01554 void setMoveOut(MMSDIRECTION moveout); 01555 01556 //! Set the modal status of the window. 01557 /*! 01558 \param modal if true, the window is marked as modal 01559 */ 01560 void setModal(bool modal); 01561 01562 //! Set the zorder status of the window. 01563 /*! 01564 \param staticzorder if true, the window automatically changes the zorder of child window during show() / setFocus() 01565 */ 01566 void setStaticZOrder(bool staticzorder); 01567 01568 //! Set the always on top flag of the window. 01569 /*! 01570 \param alwaysontop if true, the window will be permanently displayed at the top of the window stack 01571 */ 01572 void setAlwaysOnTop(bool alwaysontop); 01573 01574 //! Set the focusable flag of the window. 01575 /*! 01576 \param focusable if true, the window will can get the focus 01577 */ 01578 void setFocusable(bool focusable); 01579 01580 //! Set the backbuffer flag of the window. 01581 /*! 01582 \param backbuffer if true, the window surface has a front and a backbuffer 01583 */ 01584 void setBackBuffer(bool backbuffer); 01585 01586 //! Set the initial load flag of the window. 01587 /*! 01588 \param initialload if true, the window is loading images, fonts etc. during initialization 01589 */ 01590 void setInitialLoad(bool initialload); 01591 01592 //! Set the color of the window border. 01593 /*! 01594 \param color the border color 01595 \param refresh refresh the window after changing the border color? 01596 */ 01597 void setBorderColor(MMSFBColor color, bool refresh = true); 01598 01599 //! Set the path to the window border images. 01600 /*! 01601 \param imagepath returns the path 01602 \param load reload the border images after changing the imagepath? 01603 \param refresh refresh the window after changing the imagepath? 01604 */ 01605 void setBorderImagePath(string imagepath, bool load = true, bool refresh = true); 01606 01607 //! Set the names of the window border images. 01608 /*! 01609 \param imagename_1 the top-left image 01610 \param imagename_2 the top image 01611 \param imagename_3 the top-right image 01612 \param imagename_4 the right image 01613 \param imagename_5 the bottom-right image 01614 \param imagename_6 the bottom image 01615 \param imagename_7 the bottom-left imagethis->focusedChildWin 01616 \param imagename_8 the left image 01617 \param load reload the border images after changing the image names? 01618 \param refresh refresh the window after changing the image names? 01619 */ 01620 void setBorderImageNames(string imagename_1, string imagename_2, string imagename_3, string imagename_4, 01621 string imagename_5, string imagename_6, string imagename_7, string imagename_8, 01622 bool load = true, bool refresh = true); 01623 01624 //! Set the border thickness. 01625 /*! 01626 \param thickness the border thickness 01627 \param refresh refresh the window after changing the thickness? 01628 \param resize resize the window after changing the thickness? 01629 */ 01630 void setBorderThickness(unsigned int thickness, bool refresh = true, bool resize = true); 01631 01632 //! Set the border margin. 01633 /*! 01634 The border margin is the space between the border an the inner rectangle of the window on which the 01635 widgets or child windows will be drawn. 01636 \param margin the border margin 01637 \param refresh refresh the window after changing the margin? 01638 \param resize resize the window after changing the margin? 01639 */ 01640 void setBorderMargin(unsigned int margin, bool refresh = true, bool resize = true); 01641 01642 //! Should the window border uses round corners? 01643 /*! 01644 \param rcorners the round corners status 01645 \param refresh refresh the window after changing the rcorners? 01646 */ 01647 void setBorderRCorners(bool rcorners, bool refresh = true); 01648 01649 //! Update the current window settings with settings from another theme class. 01650 /*! 01651 \param themeClass source theme class 01652 \note Only this parameters which are set within the source theme class will be updated. 01653 */ 01654 void updateFromThemeClass(MMSWindowClass *themeClass); 01655 01656 // friends 01657 friend class MMSWindowManager; 01658 friend class MMSInputManager; 01659 friend class MMSWindowAction; 01660 friend class MMSMainWindow; 01661 friend class MMSPopupWindow; 01662 friend class MMSRootWindow; 01663 friend class MMSChildWindow; 01664 friend class MMSWidget; 01665 friend class MMSHBoxWidget; 01666 friend class MMSVBoxWidget; 01667 friend class MMSLabelWidget; 01668 friend class MMSButtonWidget; 01669 friend class MMSImageWidget; 01670 friend class MMSProgressBarWidget; 01671 friend class MMSMenuWidget; 01672 friend class MMSTextBoxWidget; 01673 friend class MMSArrowWidget; 01674 friend class MMSSliderWidget; 01675 friend class MMSInputWidget; 01676 friend class MMSCheckBoxWidget; 01677 friend class MMSCanvasWidget; 01678 }; 01679 01680 #endif /*MMSWINDOW_H_*/