Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmswindowclass.h

Go to the documentation of this file.
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-2013 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 MMSWINDOWCLASS_H_
00034 #define MMSWINDOWCLASS_H_
00035 
00036 #include "mmsgui/theme/mmsborderclass.h"
00037 
00038 //! describe attributes for MMSWindow which are additional to the MMSBorderClass
00039 namespace MMSGUI_WINDOW_ATTR {
00040 
00041     #define MMSGUI_WINDOW_ATTR_ATTRDESC \
00042         { "alignment", TAFF_ATTRTYPE_STRING }, \
00043         { "dx", TAFF_ATTRTYPE_STRING }, \
00044         { "dy", TAFF_ATTRTYPE_STRING }, \
00045         { "w", TAFF_ATTRTYPE_STRING }, \
00046         { "h", TAFF_ATTRTYPE_STRING }, \
00047         { "bgcolor", TAFF_ATTRTYPE_COLOR }, \
00048         { "bgcolor.a", TAFF_ATTRTYPE_UCHAR }, \
00049         { "bgcolor.r", TAFF_ATTRTYPE_UCHAR }, \
00050         { "bgcolor.g", TAFF_ATTRTYPE_UCHAR }, \
00051         { "bgcolor.b", TAFF_ATTRTYPE_UCHAR }, \
00052         { "bgimage", TAFF_ATTRTYPE_STRING }, \
00053         { "bgimage.path", TAFF_ATTRTYPE_STRING }, \
00054         { "bgimage.name", TAFF_ATTRTYPE_STRING }, \
00055         { "opacity", TAFF_ATTRTYPE_UCHAR }, \
00056         { "fadein", TAFF_ATTRTYPE_BOOL }, \
00057         { "fadeout", TAFF_ATTRTYPE_BOOL }, \
00058         { "debug", TAFF_ATTRTYPE_BOOL }, \
00059         { "margin", TAFF_ATTRTYPE_UCHAR }, \
00060         { "up_arrow", TAFF_ATTRTYPE_STRING }, \
00061         { "down_arrow", TAFF_ATTRTYPE_STRING }, \
00062         { "left_arrow", TAFF_ATTRTYPE_STRING }, \
00063         { "right_arrow", TAFF_ATTRTYPE_STRING }, \
00064         { "navigate_up", TAFF_ATTRTYPE_STRING }, \
00065         { "navigate_down", TAFF_ATTRTYPE_STRING }, \
00066         { "navigate_left", TAFF_ATTRTYPE_STRING }, \
00067         { "navigate_right", TAFF_ATTRTYPE_STRING }, \
00068         { "own_surface", TAFF_ATTRTYPE_BOOL }, \
00069         { "movein", TAFF_ATTRTYPE_STRING }, \
00070         { "moveout", TAFF_ATTRTYPE_STRING }, \
00071         { "modal", TAFF_ATTRTYPE_BOOL }, \
00072         { "static_zorder", TAFF_ATTRTYPE_BOOL }, \
00073         { "always_on_top", TAFF_ATTRTYPE_BOOL }, \
00074         { "focusable", TAFF_ATTRTYPE_BOOL }, \
00075         { "backbuffer", TAFF_ATTRTYPE_BOOL }, \
00076         { "initial_load", TAFF_ATTRTYPE_BOOL }
00077 
00078     #define MMSGUI_WINDOW_ATTR_IDS \
00079         MMSGUI_WINDOW_ATTR_IDS_alignment, \
00080         MMSGUI_WINDOW_ATTR_IDS_dx, \
00081         MMSGUI_WINDOW_ATTR_IDS_dy, \
00082         MMSGUI_WINDOW_ATTR_IDS_w, \
00083         MMSGUI_WINDOW_ATTR_IDS_h, \
00084         MMSGUI_WINDOW_ATTR_IDS_bgcolor, \
00085         MMSGUI_WINDOW_ATTR_IDS_bgcolor_a, \
00086         MMSGUI_WINDOW_ATTR_IDS_bgcolor_r, \
00087         MMSGUI_WINDOW_ATTR_IDS_bgcolor_g, \
00088         MMSGUI_WINDOW_ATTR_IDS_bgcolor_b, \
00089         MMSGUI_WINDOW_ATTR_IDS_bgimage, \
00090         MMSGUI_WINDOW_ATTR_IDS_bgimage_path, \
00091         MMSGUI_WINDOW_ATTR_IDS_bgimage_name, \
00092         MMSGUI_WINDOW_ATTR_IDS_opacity, \
00093         MMSGUI_WINDOW_ATTR_IDS_fadein, \
00094         MMSGUI_WINDOW_ATTR_IDS_fadeout, \
00095         MMSGUI_WINDOW_ATTR_IDS_debug, \
00096         MMSGUI_WINDOW_ATTR_IDS_margin, \
00097         MMSGUI_WINDOW_ATTR_IDS_up_arrow, \
00098         MMSGUI_WINDOW_ATTR_IDS_down_arrow, \
00099         MMSGUI_WINDOW_ATTR_IDS_left_arrow, \
00100         MMSGUI_WINDOW_ATTR_IDS_right_arrow, \
00101         MMSGUI_WINDOW_ATTR_IDS_navigate_up, \
00102         MMSGUI_WINDOW_ATTR_IDS_navigate_down, \
00103         MMSGUI_WINDOW_ATTR_IDS_navigate_left, \
00104         MMSGUI_WINDOW_ATTR_IDS_navigate_right, \
00105         MMSGUI_WINDOW_ATTR_IDS_own_surface, \
00106         MMSGUI_WINDOW_ATTR_IDS_movein, \
00107         MMSGUI_WINDOW_ATTR_IDS_moveout, \
00108         MMSGUI_WINDOW_ATTR_IDS_modal, \
00109         MMSGUI_WINDOW_ATTR_IDS_static_zorder, \
00110         MMSGUI_WINDOW_ATTR_IDS_always_on_top, \
00111         MMSGUI_WINDOW_ATTR_IDS_focusable, \
00112         MMSGUI_WINDOW_ATTR_IDS_backbuffer, \
00113         MMSGUI_WINDOW_ATTR_IDS_initial_load
00114 
00115     typedef enum {
00116         MMSGUI_BASE_ATTR_IDS,
00117         MMSGUI_BORDER_ATTR_IDS,
00118         MMSGUI_WINDOW_ATTR_IDS
00119     } ids;
00120 }
00121 
00122 
00123 class MMSWindowClass {
00124     private:
00125         struct {
00126             bool         isalignment;
00127             MMSALIGNMENT alignment;
00128             bool         isdx;
00129             bool         isdy;
00130             bool         iswidth;
00131             bool         isheight;
00132             bool         isbgcolor;
00133             MMSFBColor   bgcolor;
00134             bool         isbgimagepath;
00135             bool         isbgimagename;
00136             bool         isopacity;
00137             unsigned int opacity;
00138             bool         isfadein;
00139             bool         fadein;
00140             bool         isfadeout;
00141             bool         fadeout;
00142             bool         isdebug;
00143             bool         debug;
00144             bool         ismargin;
00145             unsigned int margin;
00146             bool         isuparrow;         //! is the uparrow set?
00147             bool         isdownarrow;       //! is the downarrow set?
00148             bool         isleftarrow;       //! is the leftarrow set?
00149             bool         isrightarrow;      //! is the rightarrow set?
00150             bool         isnavigateup;      //! is the navigateup set?
00151             bool         isnavigatedown;    //! is the navigatedown set?
00152             bool         isnavigateleft;    //! is the navigateleft set?
00153             bool         isnavigateright;   //! is the navigateright set?
00154             bool         isownsurface;
00155             bool         ownsurface;
00156             bool         ismovein;
00157             MMSDIRECTION movein;
00158             bool         ismoveout;
00159             MMSDIRECTION moveout;
00160 
00161             //! is modal flag set?
00162             bool        ismodal;
00163 
00164             //! if true, the focus cannot be changed to another window
00165             bool        modal;
00166 
00167             //! is static zorder flag set?
00168             bool        isstaticzorder;
00169 
00170             //! if true, the zorder of child windows will not automatically changed during show() or setFocus()
00171             bool        staticzorder;
00172 
00173             //! is always on top flag set?
00174             bool        isalwaysontop;
00175 
00176             //! if true, the window will be permanently displayed at the top of the window stack
00177             bool        alwaysontop;
00178 
00179             //! is focusable flag set?
00180             bool        isfocusable;
00181 
00182             //! window can get the focus true/false
00183             bool        focusable;
00184 
00185             //! is backbuffer flag set?
00186             bool        isbackbuffer;
00187 
00188             //! window surface has an backbuffer true/false
00189             bool        backbuffer;
00190 
00191             //! is initial load flag set?
00192             bool        isinitialload;
00193 
00194             //! window should load images, fonts etc. during initialization true/false
00195             bool        initialload;
00196         } id;
00197 
00198         struct {
00199             string       *dx;
00200             string       *dy;
00201             string       *width;
00202             string       *height;
00203             string       *bgimagepath;
00204             string       *bgimagename;
00205             string       *uparrow;          //! the name of the widget which represents the scroll up arrow
00206             string       *downarrow;        //! the name of the widget which represents the scroll down arrow
00207             string       *leftarrow;        //! the name of the widget which represents the scroll left arrow
00208             string       *rightarrow;       //! the name of the widget which represents the scroll right arrow
00209             string       *navigateup;       //! the name of the window to which should navigate up
00210             string       *navigatedown;     //! the name of the window to which should navigate down
00211             string       *navigateleft;     //! the name of the window to which should navigate left
00212             string       *navigateright;    //! the name of the window to which should navigate right
00213         } ed;
00214 
00215         /* init routines */
00216         void initAlignment();
00217         void initDx();
00218         void initDy();
00219         void initWidth();
00220         void initHeight();
00221         void initBgColor();
00222         void initBgImagePath();
00223         void initBgImageName();
00224         void initOpacity();
00225         void initFadeIn();
00226         void initFadeOut();
00227         void initDebug();
00228         void initMargin();
00229         void initUpArrow();
00230         void initDownArrow();
00231         void initLeftArrow();
00232         void initRightArrow();
00233         void initNavigateUp();
00234         void initNavigateDown();
00235         void initNavigateLeft();
00236         void initNavigateRight();
00237         void initOwnSurface();
00238         void initMoveIn();
00239         void initMoveOut();
00240         void initModal();
00241         void initStaticZOrder();
00242         void initAlwaysOnTop();
00243         void initFocusable();
00244         void initBackBuffer();
00245         void initInitialLoad();
00246 
00247         /* free routines */
00248         void freeAlignment();
00249         void freeDx();
00250         void freeDy();
00251         void freeWidth();
00252         void freeHeight();
00253         void freeBgColor();
00254         void freeBgImagePath();
00255         void freeBgImageName();
00256         void freeOpacity();
00257         void freeFadeIn();
00258         void freeFadeOut();
00259         void freeDebug();
00260         void freeMargin();
00261         void freeUpArrow();
00262         void freeDownArrow();
00263         void freeLeftArrow();
00264         void freeRightArrow();
00265         void freeNavigateUp();
00266         void freeNavigateDown();
00267         void freeNavigateLeft();
00268         void freeNavigateRight();
00269         void freeOwnSurface();
00270         void freeMoveIn();
00271         void freeMoveOut();
00272         void freeModal();
00273         void freeStaticZOrder();
00274         void freeAlwaysOnTop();
00275         void freeFocusable();
00276         void freeBackBuffer();
00277         void freeInitialLoad();
00278 
00279         //! Read and set all attributes from the given TAFF buffer.
00280         /*!
00281         \param tafff        pointer to the TAFF buffer
00282         \param path         optional, path needed for empty path values from the TAFF buffer
00283         \param reset_paths  optional, should reset all path attributes?
00284         */
00285         void setAttributesFromTAFF(MMSTaffFile *tafff, string *path = NULL, bool reset_paths = false);
00286 
00287     public:
00288         MMSBorderClass border;
00289 
00290         MMSWindowClass();
00291         ~MMSWindowClass();
00292         MMSWindowClass &operator=(const MMSWindowClass &c);
00293         //
00294         void unsetAll();
00295 
00296         bool isAlignment();
00297         void unsetAlignment();
00298         void setAlignment(MMSALIGNMENT alignment);
00299         bool getAlignment(MMSALIGNMENT &alignment);
00300         //
00301         bool isDx();
00302         void unsetDx();
00303         void setDx(const string &dx);
00304         bool getDx(string &dx);
00305         //
00306         bool isDy();
00307         void unsetDy();
00308         void setDy(const string &dy);
00309         bool getDy(string &dy);
00310         //
00311         bool isWidth();
00312         void unsetWidth();
00313         void setWidth(const string &width);
00314         bool getWidth(string &width);
00315         //
00316         bool isHeight();
00317         void unsetHeight();
00318         void setHeight(const string &height);
00319         bool getHeight(string &height);
00320         //
00321         bool isBgColor();
00322         void unsetBgColor();
00323         void setBgColor(const MMSFBColor &bgcolor);
00324         bool getBgColor(MMSFBColor &bgcolor);
00325         //
00326         bool isBgImagePath();
00327         void unsetBgImagePath();
00328         void setBgImagePath(const string &bgimagepath);
00329         bool getBgImagePath(string &bgimagepath);
00330         //
00331         bool isBgImageName();
00332         void unsetBgImageName();
00333         void setBgImageName(const string &bgimagename);
00334         bool getBgImageName(string &bgimagename);
00335         //
00336         bool isOpacity();
00337         void unsetOpacity();
00338         void setOpacity(unsigned int opacity);
00339         bool getOpacity(unsigned int &opacity);
00340         //
00341         bool isFadeIn();
00342         void unsetFadeIn();
00343         void setFadeIn(bool fadein);
00344         bool getFadeIn(bool &fadein);
00345         //
00346         bool isFadeOut();
00347         void unsetFadeOut();
00348         void setFadeOut(bool fadeout);
00349         bool getFadeOut(bool &fadeout);
00350         //
00351         bool isDebug();
00352         void unsetDebug();
00353         void setDebug(bool debug);
00354         bool getDebug(bool &debug);
00355         //
00356         bool isMargin();
00357         void unsetMargin();
00358         void setMargin(unsigned int margin);
00359         bool getMargin(unsigned int &margin);
00360 
00361         ////////////////////////////////////////////////////////////////////////
00362 
00363         //! Check if the uparrow is set.
00364         bool isUpArrow();
00365 
00366         //! Mark the uparrow as not set.
00367         void unsetUpArrow();
00368 
00369         //! Set the uparrow.
00370         /*!
00371         \param uparrow  the name of the widget which represents the navigate up arrow
00372         */
00373         void setUpArrow(const string &uparrow);
00374 
00375 
00376         //! Get the uparrow.
00377         /*!
00378         \param uparrow  the name of the widget which represents the navigate up arrow
00379         \return true if set
00380         */
00381         bool getUpArrow(string &uparrow);
00382 
00383         ////////////////////////////////////////////////////////////////////////
00384 
00385         //! Check if the downarrow is set.
00386         bool isDownArrow();
00387 
00388         //! Mark the downarrow as not set.
00389         void unsetDownArrow();
00390 
00391         //! Set the downarrow.
00392         /*!
00393         \param downarrow  the name of the widget which represents the navigate down arrow
00394         */
00395         void setDownArrow(const string &downarrow);
00396 
00397         //! Get the downarrow.
00398         /*!
00399         \param downarrow  the name of the widget which represents the navigate down arrow
00400         \return true if set
00401         */
00402         bool getDownArrow(string &downarrow);
00403 
00404         ////////////////////////////////////////////////////////////////////////
00405 
00406         //! Check if the leftarrow is set.
00407         bool isLeftArrow();
00408 
00409         //! Mark the leftarrow as not set.
00410         void unsetLeftArrow();
00411 
00412         //! Set the leftarrow.
00413         /*!
00414         \param leftarrow  the name of the widget which represents the navigate left arrow
00415         */
00416         void setLeftArrow(const string &leftarrow);
00417 
00418         //! Get the leftarrow.
00419         /*!
00420         \param leftarrow  the name of the widget which represents the navigate left arrow
00421         \return true if set
00422         */
00423         bool getLeftArrow(string &leftarrow);
00424 
00425         ////////////////////////////////////////////////////////////////////////
00426 
00427         //! Check if the rightarrow is set.
00428         bool isRightArrow();
00429 
00430         //! Mark the rightarrow as not set.
00431         void unsetRightArrow();
00432 
00433         //! Set the rightarrow.
00434         /*!
00435         \param rightarrow  the name of the widget which represents the navigate right arrow
00436         */
00437         void setRightArrow(const string &rightarrow);
00438 
00439         //! Get the rightarrow.
00440         /*!
00441         \param rightarrow  the name of the widget which represents the navigate right arrow
00442         \return true if set
00443         */
00444         bool getRightArrow(string &rightarrow);
00445 
00446         ////////////////////////////////////////////////////////////////////////
00447 
00448         //! Check if the navigateup is set.
00449         bool isNavigateUp();
00450 
00451         //! Mark the navigateup as not set.
00452         void unsetNavigateUp();
00453 
00454         //! Set the navigateup window.
00455         /*!
00456         \param navigateup  the name of the window to which should navigate up
00457         */
00458         void setNavigateUp(const string &navigateup);
00459 
00460         //! Get the navigateup window.
00461         /*!
00462         \param navigateup  the name of the window to which should navigate up
00463         \return true if set
00464         */
00465         bool getNavigateUp(string &navigateup);
00466 
00467         ////////////////////////////////////////////////////////////////////////
00468 
00469         //! Check if the navigatedown is set.
00470         bool isNavigateDown();
00471 
00472         //! Mark the navigatedown as not set.
00473         void unsetNavigateDown();
00474 
00475         //! Set the navigatedown window.
00476         /*!
00477         \param navigatedown  the name of the window to which should navigate down
00478         */
00479         void setNavigateDown(const string &navigatedown);
00480 
00481         //! Get the navigatedown window.
00482         /*!
00483         \param navigatedown  the name of the window to which should navigate down
00484         \return true if set
00485         */
00486         bool getNavigateDown(string &navigatedown);
00487 
00488         ////////////////////////////////////////////////////////////////////////
00489 
00490         //! Check if the navigateleft is set.
00491         bool isNavigateLeft();
00492 
00493         //! Mark the navigateleft as not set.
00494         void unsetNavigateLeft();
00495 
00496         //! Set the navigateleft window.
00497         /*!
00498         \param navigateleft  the name of the window to which should navigate left
00499         */
00500         void setNavigateLeft(const string &navigateleft);
00501 
00502         //! Get the navigateleft window.
00503         /*!
00504         \param navigateleft  the name of the window to which should navigate left
00505         \return true if set
00506         */
00507         bool getNavigateLeft(string &navigateleft);
00508 
00509         ////////////////////////////////////////////////////////////////////////
00510 
00511         //! Check if the navigateright is set.
00512         bool isNavigateRight();
00513 
00514         //! Mark the navigateright as not set.
00515         void unsetNavigateRight();
00516 
00517         //! Set the navigateright.
00518         /*!
00519         \param navigateright  the name of the window to which should navigate right
00520         */
00521         void setNavigateRight(const string &navigateright);
00522 
00523         //! Get the navigateright window.
00524         /*!
00525         \param navigateright  the name of the window to which should navigate right
00526         \return true if set
00527         */
00528         bool getNavigateRight(string &navigateright);
00529 
00530         //
00531         bool isOwnSurface();
00532         void unsetOwnSurface();
00533         void setOwnSurface(bool ownsurface);
00534         bool getOwnSurface(bool &ownsurface);
00535 
00536 
00537         bool isMoveIn();
00538         void unsetMoveIn();
00539         void setMoveIn(MMSDIRECTION movein);
00540         bool getMoveIn(MMSDIRECTION &movein);
00541 
00542         bool isMoveOut();
00543         void unsetMoveOut();
00544         void setMoveOut(MMSDIRECTION moveout);
00545         bool getMoveOut(MMSDIRECTION &moveout);
00546 
00547         bool isModal();
00548         void unsetModal();
00549         void setModal(bool modal);
00550         bool getModal(bool &modal);
00551 
00552         bool isStaticZOrder();
00553         void unsetStaticZOrder();
00554         void setStaticZOrder(bool staticzorder);
00555         bool getStaticZOrder(bool &staticzorder);
00556 
00557         bool isAlwaysOnTop();
00558         void unsetAlwaysOnTop();
00559         void setAlwaysOnTop(bool alwaysontop);
00560         bool getAlwaysOnTop(bool &alwaysontop);
00561 
00562         bool isFocusable();
00563         void unsetFocusable();
00564         void setFocusable(bool focusable);
00565         bool getFocusable(bool &focusable);
00566 
00567         bool isBackBuffer();
00568         void unsetBackBuffer();
00569         void setBackBuffer(bool backbuffer);
00570         bool getBackBuffer(bool &backbuffer);
00571 
00572         bool isInitialLoad();
00573         void unsetInitialLoad();
00574         void setInitialLoad(bool initialload);
00575         bool getInitialLoad(bool &initialload);
00576 
00577     // friends
00578     friend class MMSThemeManager;
00579     friend class MMSDialogManager;
00580 };
00581 
00582 #endif /*MMSWINDOWCLASS_H_*/

Generated by doxygen