ngl-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ngl-commits] lot of changes in the nui windowing system: [...]


From: Sebastien Metrot <address@hidden>
Subject: [ngl-commits] lot of changes in the nui windowing system: [...]
Date: Fri, 03 Oct 2003 19:31:11 -0400

Commit from meeloo 2003-10-03 19:31 EDT
lot of changes in the nui windowing system:
nuiMainWindow have been broken in the nuiTopLevel, nuiWindowManager and nuiMainWindow
see the mail on ngl-devel ML to learn about the changes...

BEWARE! Some features are now broken and will be added back ASAP (and YOU can help make it faster, it should even be quite easy with this new code base).
Module File name Revision
nui libnui.vcproj 1.35 >>> 1.36
nui examples/nuitest/nuiGearWin.cpp 1.28 >>> 1.29
nui examples/nuitest/nuiGearWin.h 1.7 >>> 1.8
nui examples/nuitest/nuiWin.cpp 1.90 >>> 1.91
nui examples/nuitest/nuiWin.h 1.15 >>> 1.16
nui examples/viewer/ViewerApp.cpp 1.10 >>> 1.11
nui include/nuiMainWindow.h 1.38 >>> 1.39
nui include/nuiMenu.h 1.12 >>> 1.13
nui include/nuiRect.h 1.18 >>> 1.19
nui include/nuiTheme.h 1.18 >>> 1.19
+ nui include/nuiTopLevel.h 1.1
nui include/nuiWidget.h 1.27 >>> 1.28
nui include/nuiWindow.h 1.27 >>> 1.28
+ nui include/nuiWindowManager.h 1.1
nui src/core/nuiBuilder.cpp 1.21 >>> 1.22
nui src/core/nuiContainer.cpp 1.34 >>> 1.35
nui src/core/nuiDragAndDrop.cpp 1.12 >>> 1.13
nui src/core/nuiMainWindow.cpp 1.94 >>> 1.95
nui src/core/nuiTheme.cpp 1.55 >>> 1.56
+ nui src/core/nuiTopLevel.cpp 1.1
nui src/core/nuiWidget.cpp 1.45 >>> 1.46
nui src/core/nuiWindow.cpp 1.50 >>> 1.51
+ nui src/core/nuiWindowManager.cpp 1.1
nui src/widgets/nuiFileSelector.cpp 1.2 >>> 1.3
nui src/widgets/nuiInspectorTable.cpp 1.13 >>> 1.14
nui src/windows/nuiMenu.cpp 1.19 >>> 1.20

nui/examples/nuitest/nuiGearWin.h   1.7 >>> 1.8
Line 37
  class nuiGearWin : public nuiWindow 
  {
  public:
-   nuiGearWin(nuiMainWindow* pParent, const nuiRect& rRect);
+   nuiGearWin(nuiWindowManager* pParent, const nuiRect& rRect);
    ~nuiGearWin();
 
    bool ShowMenu(nuiEvent* pEvent);

nui/examples/nuitest/nuiWin.h   1.15 >>> 1.16
Line 28
  class Gears;
  class nuiEvent;
  class nuiInspectorTable;
+ class nuiWindowManager;
 
  class nuiWin : public nuiMainWindow
  {
Line 62
    bool Draw(nuiDrawContext* pContext);
 
  protected:
+
+   // The window manager:
+   nuiWindowManager* mpManager;
+
    Gears* mpGears;
    bool mAnimate;
    nuiEventSink<nuiWin> mWinSink;

nui/include/nuiMainWindow.h   1.38 >>> 1.39
Line 22
 
  #include "ngl.h"
  #include "nglWindow.h"
-
+ #include "nuiTopLevel.h"
  #include "nuiContainer.h"
  #include "nuiWindow.h"
  #include "nuiEvent.h"
Line 31
  #include "nuiTimer.h"
  #include "nuiDrawContext.h"
  #include "nuiMemoryDrawContext.h"
+ #include "nuiWindowManager.h"
 
  #include <stack>
 
  class nuiLabel;
  class nuiMainWindow;
- class nuiTrashElement;
-
- enum nuiRenderer
- {
-   eOpenGL,
-   eSoftware
- };
-
- class nuiTrashElement
- {
- public:
-   enum ElementType
-   {
-     AddWidget,
-     RemoveWidget,
-     DeleteWidget
-   };
-
-   nuiTrashElement(ElementType type, nuiWidgetPtr pWidget, nuiContainerPtr pContainer = NULL);
-   nuiTrashElement(const nuiTrashElement& rSrc);
-   virtual ~nuiTrashElement();
-
-   friend bool operator==(const nuiTrashElement& rElement1,const nuiTrashElement& rElement2);
-   friend class nuiMainWindow;
-
- protected:
-   ElementType mType;
-   nuiWidgetPtr mpWidget;
-   nuiContainerPtr mpContainer;
- };
 
  /// This class implements the root nui object: the main window of any application.
- class nuiMainWindow :  public nglWindow, public nuiContainer
+ class nuiMainWindow :  public nglWindow, public nuiTopLevel
  {
  public:
    nuiMainWindow(const nglContextInfo& rContextInfo, const nglWindowInfo& rInfo, const nglContext* pShared = NULL, const nglPath& mResPath = nglPath(ePathCurrent));
    nuiMainWindow(uint Width, uint Height, bool Fullscreen=false, const nglPath& mResPath = nglPath(ePathCurrent));
-   nuiMainWindow(nuiContainerPtr pParent, nuiXMLNode* pNode, int W, int H, bool Fullscreen, const nglPath& mResPath = nglPath(ePathCurrent)); ///< Create from an XML description.
+   nuiMainWindow(nuiXMLNode* pNode, int W, int H, bool Fullscreen, const nglPath& mResPath = nglPath(ePathCurrent)); ///< Create from an XML description.
 
    virtual ~nuiMainWindow();
 
Line 97
    virtual void OnMouseMove   (nglMouseInfo& rInfo);
    //@}
 
+   bool IsKeyDown (nglKeyCode Key);
+   void GetMouseInfo(nglMouseInfo& rMouseInfo);
+
    /* @name Background methods*/
    //@{
    void SetBackgroundColor(const nuiColor& rColor); ///< Set unique bg color.
Line 104
 
    /* @name Inherited from nuiWidget */
    //@{
-   bool Draw(class nuiDrawContext *);
    void Invalidate(bool LayoutChanged = false, bool TellChildren=false);
-   nuiDrawContext* GetDrawContext();
-   //@}
-
-   /* @name Popup windows management */
-   //@{
-   // The Active window receives all the keyboard events and dipatches them to its widgets. It also is the top level window.
-   nuiWindow* GetActiveWindow(); ///< Return the current active popup window.
-   bool ActivateWindow(nuiWindow* pWindow); ///< Change the current active popup window.
-   bool IsParentActive(); ///< Allways true for the mainwindow!
-   bool AddWindow(nuiWindow* pWindow); ///< Add a popup window to the list.
-   bool DelWindow(nuiWindow* pWindow, bool Delete=false); ///< Remove a popup window from the list. If Delete==true the object will also be deleted.
-   uint GetWindowCount(); ///< Return the number of popup windows contained in the main window.
-   nuiWindow* GetWindow(uint index); ///< Return the window object with the given index rank in the list.
-   nuiWindow* GetWindow(nuiSize X, nuiSize Y); ///< Return the window object directly under the (X,Y) pixel.
-   //@}
-
-   virtual nuiWidgetPtr GetChild(nuiSize X, nuiSize Y); ///< Reimplemented from nuiContainer::GetChild
-
-   /* @name Mouse & keyboard focus management */
-   //@{
-   virtual bool Grab(nuiWidgetPtr pWidget); ///< Redirect all mouse event to this object.
-   virtual bool Ungrab(); ///< Stop redirecting all mouse event to the last grab object.
-   virtual nuiWidgetPtr GetGrab(); ///< Returns the object that currently has the mouse focus.
-
-   virtual bool SetFocus(nuiWidgetPtr pWidget); ///< Redirect all keyboard events to this object.
-   virtual nuiWidgetPtr GetFocus(); ///< Returns the object that currently has the keyboard focus.
-  //@}
-
-   /* @name Trash management */
-   //@{
-   virtual void FillTrash(); ///< Marks the start of a trash filling period: we collect all the movement going on in the widget tree.
-   virtual bool IsTrashFilling(); ///< Are we collectiong change in the widget tree right now?
-   virtual void EmptyTrash(); ///< Empties the object trash: all the objects that have been placed in the trash (with the Trash() method) will be delete an removed from the trash. This method should be called after processing any event (comming from nglWindow).
-   virtual void AdviseObjectDeath(nuiWidgetPtr pWidget); ///< Any nuiWidget will call this method when dying. Don't forget to call this version in any overriden AdviseObjectDeath you make.
-   virtual void Trash(nuiWidgetPtr pWidget); ///< Ask for the destruction of this object as soon as possible.
-   virtual void AddToParent(nuiWidgetPtr pWidget,nuiContainerPtr pNewParent); ///< Ask for the addition of this object to his parent as soon as possible.
-   virtual void RemoveFromParent(nuiWidgetPtr pWidget,nuiContainerPtr pParent); ///< Ask for the removal of this object from its parent as soon as possible.
-   //@}
-
-   virtual void SetClipChildren(bool set); ///< Enables or disables automatic children clipping. If set to true all children's drawing will be restrained to their rectangle. 
-   virtual bool GetClipChildren(); ///< Returns children clipping status. 
-   virtual void SetStaticChildren(bool Set); ///< Change the widget layout policy of the main window. If set to true all the children of the main window will be freely positionable in the window, otherwise they will be given the full client size of the window. 
-   virtual bool GetStaticChildren(); ///< Return the children layout policy. See SetStaticChildren(). 
-
-   /** @name Generic tooltips */
-   //@{
-   virtual bool ActivateToolTip(nuiWidgetPtr pWidget); ///< nuiMainWindow override the default tooltip mecanism to actually display them.
-   virtual bool ReleaseToolTip(nuiWidgetPtr pWidget); ///< Remove the current tooltip for the given widget. 
-   virtual bool ToolTipOn(nuiEvent* pEvent);
-   virtual bool ToolTipOff(nuiEvent* pEvent);
+   bool SetMouseCursor(nglWindow::CursorModel Cursor);
    //@}
 
    /** @name Debugging helper functions */
Line 174
    float GetFrameRateLimit(); ///< Return the maximum framerate to use for this main window (in number of frames per second). If it returns 0 there is no limit. 
    //@}
 
-   /** @name Renderer choice: */
-   //@{
-   static void SetRenderer(nuiRenderer Renderer = eOpenGL);
-   //@}
-
  protected:
    nuiBool mBitmapBackGround;
    nuiBool mSolidBackGround;
 
    nuiColor mBgColor; // One color for each corner
 
- //  nuiDrawContext mDrawContext;
- //  nuiMemoryDrawContext mDrawContext;
-   nuiDrawContext* mpDrawContext;
-
-   nuiWidgetPtr mpGrab;
-   nuiWidgetPtr mpFocus;
-   nuiWidgetPtr mpUnderMouse;
-
-   std::list<nuiWindowPtr> mpWindows;
-   nuiBool mIteratingWindows;
-   std::list<nuiWindowPtr> mpPreWindows;
-   std::list<nuiWidgetPtr> mpGrabStack;
-
-   nuiBool mClipChildren;
-   nuiBool mStaticChildren;
-
-   // ToolTips:
-   nuiTimer mToolTipTimerOn;
-   nuiTimer mToolTipTimerOff;
-   nglTime mToolTipDelayOn;
-   nglTime mToolTipDelayOff;
    nuiEventSink<nuiMainWindow> mMainWinSink;
-   bool mDisplayToolTip;
-   nuiWidgetPtr mpToolTipSource;
-   nuiLabel* mpToolTipLabel;
-   nuiLabel* mpInfoLabel;
 
    float mMaxFPS;
    nglTime mLastRendering;
    nuiTimer* mpInvalidateTimer;
    bool InvalidateTimer(nuiEvent* pEvent);
-   /* @name Trash management */
-   //@{
- private:
-   bool mFillTrash;
-   std::list<nuiTrashElement> mpTrash;
-   
-   //@}
-
  private:
    /* @name Debugging */
    //@{
Line 231
    nuiBool mDisplayMouseOverObject;
    //@}
 
-   static nuiRenderer mRenderer;
  };
-
-
- bool operator==(const nuiTrashElement& rElement1,const nuiTrashElement& rElement2);
 
  #endif // __nuiMainWindow_h__

nui/include/nuiMenu.h   1.12 >>> 1.13
Line 30
  class nuiMenu : public nuiWindow
  {
  public:
-   nuiMenu(nuiMainWindow* pParent, const nuiRect& rRect); ///< Create a menu in the given MainWindow. The rectangle's size is ignored as the menu will query is items to decide its size. 
+   nuiMenu(nuiWindowManager* pParent, const nuiRect& rRect); ///< Create a menu in the given MainWindow. The rectangle's size is ignored as the menu will query is items to decide its size. 
    nuiMenu(nuiContainerPtr pParent, nuiXMLNode* pNode); ///< Create from an XML description.
    virtual ~nuiMenu();
 

nui/include/nuiRect.h   1.18 >>> 1.19
Line 157
 
    inline void MoveTo(nuiSize X, nuiSize Y)
    {
-     mRight += X - mLeft;
-     mBottom += Y - mTop;
+     nuiSize w,h;
+     w = mRight - mLeft;
+     h = mBottom - mTop;
      mLeft = X;
      mTop = Y;
+     mRight = mLeft + w;
+     mBottom = mTop + h;
  #ifdef USE_NUIVALUETYPES  
      Changed();
  #endif

nui/include/nuiTheme.h   1.18 >>> 1.19
Line 82
    virtual void DrawWindow(nuiDrawContext* pContext, nuiWindow* pWindow); ///< Render a normal window border
    virtual void DrawActiveWindow(nuiDrawContext* pContext, nuiWindow* pWindow); ///< Render a Top Level window border
    virtual void DrawMovingWindow(nuiDrawContext* pContext, nuiWindow* pWindow);
-   virtual void AdjustWindowRect(nuiRect& rRect, nuiWindowFlags Flags);
+   virtual void AdjustWindowRect(nuiRect& rRect, nuiWindowFlags Flags, bool RectIsClient = true);
    virtual bool IsInsideWindow(nuiRect Rect,nuiSize X,nuiSize Y,nuiWindowFlags Flags);
-   virtual nuiPosition GetWindowPart(nuiRect rect,nuiSize X,nuiSize Y,nuiWindowFlags Flags);
+   virtual nuiPosition GetWindowPart(nuiRect rect,nuiSize X,nuiSize Y,nuiWindowFlags Flags, bool RectIsClient = true);
    virtual void DrawWindowBackground(nuiDrawContext* pContext, nuiWindow* pWindow, nuiColor& DefaultColor);
 
    // Scrollbar:

nui/include/nuiTopLevel.h   1.1
Line 0
+ /*
+   NUI - C++ cross-platform GUI framework for OpenGL based applications
+   Copyright (C) 2002-2003 Sébastien Métrot
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+ #ifndef __nuiTopLevel_h__
+ #define __nuiTopLevel_h__
+
+ #include "ngl.h"
+ #include "nuiContainer.h"
+
+ class nuiLabel;
+
+ enum nuiRenderer
+ {
+   eOpenGL,
+   eSoftware
+ };
+
+ class nuiTrashElement;
+
+ class nuiTrashElement
+ {
+ public:
+   enum ElementType
+   {
+     AddWidget,
+     RemoveWidget,
+     DeleteWidget
+   };
+
+   nuiTrashElement(ElementType type, nuiWidgetPtr pWidget, nuiContainerPtr pContainer = NULL);
+   nuiTrashElement(const nuiTrashElement& rSrc);
+   virtual ~nuiTrashElement();
+
+   friend bool operator==(const nuiTrashElement& rElement1,const nuiTrashElement& rElement2);
+   friend class nuiTopLevel;
+
+ protected:
+   ElementType mType;
+   nuiWidgetPtr mpWidget;
+   nuiContainerPtr mpContainer;
+ };
+
+
+ class nuiTopLevel : public nuiContainer
+ {
+ public:
+   /** @name Life */
+   //@{
+   nuiTopLevel(); ///< Create an nuiTopLevel.
+   nuiTopLevel(nuiXMLNode* pNode); ///< Create an nuiObject from an XML description.
+   virtual ~nuiTopLevel(); 
+   //@}
+
+   /* @name Trash management */
+   //@{
+   virtual void FillTrash(); ///< Marks the start of a trash filling period: we collect all the movement going on in the widget tree.
+   virtual bool IsTrashFilling(); ///< Are we collectiong change in the widget tree right now?
+   virtual void EmptyTrash(); ///< Empties the object trash: all the objects that have been placed in the trash (with the Trash() method) will be delete an removed from the trash. This method should be called after processing any event (comming from nglWindow).
+   virtual void AdviseObjectDeath(nuiWidgetPtr pWidget); ///< Any nuiWidget will call this method when dying. Don't forget to call this version in any overriden AdviseObjectDeath you make.
+   virtual void Trash(nuiWidgetPtr pWidget); ///< Ask for the destruction of this object as soon as possible.
+   virtual void AddToParent(nuiWidgetPtr pWidget,nuiContainerPtr pNewParent); ///< Ask for the addition of this object to his parent as soon as possible.
+   virtual void RemoveFromParent(nuiWidgetPtr pWidget,nuiContainerPtr pParent); ///< Ask for the removal of this object from its parent as soon as possible.
+   //@}
+
+   /** @name Rendering: */
+   //@{
+   bool Draw(class nuiDrawContext *pContext);
+   //@}
+
+
+   /** @name Renderer choice: */
+   //@{
+   nuiDrawContext* GetDrawContext();
+   static void SetRenderer(nuiRenderer Renderer = eOpenGL);
+   //@}
+
+   nuiTopLevel* GetTopLevel();
+
+   /* @name Mouse & keyboard focus management */
+   //@{
+   virtual bool Grab(nuiWidgetPtr pWidget); ///< Redirect all mouse event to this object.
+   virtual bool Ungrab(); ///< Stop redirecting all mouse event to the last grab object.
+   virtual nuiWidgetPtr GetGrab(); ///< Returns the object that currently has the mouse focus.
+   virtual bool CancelGrab(); ///< Cancel any current ongoing grab action and empty the grab stack.
+
+   virtual bool SetFocus(nuiWidgetPtr pWidget); ///< Redirect all keyboard events to this object.
+   virtual nuiWidgetPtr GetFocus(); ///< Returns the object that currently has the keyboard focus.
+   //@}
+
+   /** @name Generic tooltips */
+   //@{
+   virtual bool ActivateToolTip(nuiWidgetPtr pWidget); ///< nuiMainWindow override the default tooltip mecanism to actually display them.
+   virtual bool ReleaseToolTip(nuiWidgetPtr pWidget); ///< Remove the current tooltip for the given widget. 
+   virtual bool ToolTipOn(nuiEvent* pEvent);
+   virtual bool ToolTipOff(nuiEvent* pEvent);
+   //@}
+
+   virtual bool IsKeyDown (nglKeyCode Key);
+
+   // Events entry points:
+   void CallKeyDown (nglKeyCode Key, nglChar Char);
+   void CallKeyUp (nglKeyCode Key, nglChar Char);
+   void CallMouseClick (nglMouseInfo& rInfo);
+   void CallMouseUnclick(nglMouseInfo& rInfo);
+   void CallMouseMove (nglMouseInfo& rInfo);
+   void GetMouseInfo(nglMouseInfo& rMouseInfo);
+
+ protected:
+   void SetDrawContext(nuiDrawContext* pDrawContext);
+
+   nuiWidgetPtr mpGrab;
+   nuiWidgetPtr mpFocus;
+   nuiWidgetPtr mpUnderMouse;
+
+   // ToolTips:
+   nuiTimer mToolTipTimerOn;
+   nuiTimer mToolTipTimerOff;
+   nglTime mToolTipDelayOn;
+   nglTime mToolTipDelayOff;
+   bool mDisplayToolTip;
+   nuiWidgetPtr mpToolTipSource;
+   nuiLabel* mpToolTipLabel;
+   nuiLabel* mpInfoLabel;
+
+   std::list<nuiWidgetPtr> mpGrabStack;
+
+ private:
+   /* @name Trash management */
+   //@{
+   bool mFillTrash;
+   std::list<nuiTrashElement> mpTrash;
+   //@}
+
+   nuiDrawContext* mpDrawContext;
+
+   static nuiRenderer mRenderer;
+
+   nglMouseInfo mMouseInfo;
+
+   nuiEventSink<nuiTopLevel> mTopLevelSink;
+ };
+
+ bool operator==(const nuiTrashElement& rElement1,const nuiTrashElement& rElement2);
+
+ typedef nuiTopLevel* nuiTopLevelPtr;
+
+
+ #endif
\  No newline at end of file

nui/include/nuiWidget.h   1.27 >>> 1.28
Line 31
  class nuiDrawContext;
  class nuiWidget;
 
+ class nuiTopLevel;
+
  typedef nuiWidget* nuiWidgetPtr;
  typedef std::list<nuiWidgetPtr> nuiWidgetList;
 
Line 58
    //@{
    virtual nuiContainerPtr GetParent(); ///< Return the parent of this object
    virtual nuiContainerPtr GetRoot(); ///< Return the top parent of this object. 
+   virtual nuiTopLevel* GetTopLevel(); ///< Return the top level parent of this object if it exists.
    virtual bool SetParent(nuiContainerPtr pParent); ///< Set the parent of this object. 
    virtual bool IsParentActive(); ///< Return true if this object main parent is an active window.
    virtual bool Trash(); ///< This method will try to destroy the nuiObject as soon as possible. Returns true if the destruction is ongoing, false if there was a problem. Use this method instead of the delete C++ keyword all the time!!!!
Line 198
    nuiSimpleEventSource <nuiWidgetHoverOn     > HoverOn; ///< Send an event when the mouse is hovering on the object.
    nuiSimpleEventSource <nuiWidgetHoverOff    > HoverOff; ///< Send an event when the mouse stops hovering on the object.
    nuiSimpleEventSource <nuiWidgetHoverChanged> HoverChanged; ///< Send an event when the hovering state changes.
+
+   nuiSimpleEventSource <nuiMoved> UserRectChanged; ///< Send an event when the hovering state changes.
 
    nuiMouseClicked Clicked; ///< Send an event when the widget is clicked. This event is fired after the MouseClicked method is called on the widget.
    nuiMouseUnclicked Unclicked; ///< Send an event when the widget is clicked. This event is fired after the MouseUnclicked method is called on the widget.

nui/include/nuiWindow.h   1.27 >>> 1.28
Line 28
 
  class nuiButton;
  class nuiMainWindow;
+ class nuiWindowManager;
 
  /// A nui window is an overlapped popup window. It can only be owned by a MainWindow.
  class nuiWindow : public nuiContainer
Line 44
    static const nuiWindowFlags Modal;          ///< The window if modal: no other window created before it can receive any mouse of keyboard event until it is destroyed.
 
    // Construction/Destruction
-   nuiWindow(nuiMainWindow* pParent, const nuiRect& rRect, nuiWindowFlags Flags=NoFlag, nglString Title=nglString(_T("nuiWindow")));
+   nuiWindow(nuiWindowManager* pParent, const nuiRect& rRect, nuiWindowFlags Flags=NoFlag, nglString Title=nglString(_T("nuiWindow")));
    nuiWindow(nuiContainerPtr pParent, nuiXMLNode* pNode); ///< Create from an XML description.
    virtual ~nuiWindow();
 
    virtual nuiXMLNode* Serialize(nuiXMLNode* pParentNode, bool Recursive);
 
    // Parenting:
-   bool SetParent(nuiMainWindow* pParent);
+   bool SetParent(nuiWindowManager* pParent);
    virtual bool IsParentActive(); ///< Return true if this object is the active object.
 
    // Rendering & theme ops:
Line 75
    virtual void OnActivation();    ///< Called when the window gains the keyboard focus.
    virtual void OnDesactivation(); ///< Called when the window looses the keyboard focus.
 
-   virtual bool MouseClicked  (nuiSize X, nuiSize Y, nglMouseInfo::Flags Button);
-   virtual bool MouseUnclicked  (nuiSize X, nuiSize Y, nglMouseInfo::Flags Button);
-   virtual bool MouseMoved  (nuiSize X, nuiSize Y);
-
    // Flags:
    virtual void SetFlags(nuiWindowFlags Flags);
    virtual nuiWindowFlags GetFlags();
Line 92
    nuiMouseUnclicked UnclickedMouse;
    nuiMouseMoved     MovedMouse;
    nuiSimpleEventSource<nuiButtonPressed> CloseButtonPressed;
+   nuiSimpleEventSource<nuiValueChanged> FlagsChanged;
 
  protected:
-   friend class nuiMainWindow;
-   virtual bool DispatchMouseClick (nuiSize X, nuiSize Y, nglMouseInfo::Flags Button);
-   virtual bool DispatchMouseUnclick(nuiSize X, nuiSize Y, nglMouseInfo::Flags Button);
-   virtual bool DispatchMouseMove   (nuiSize X, nuiSize Y);
+   friend class nuiWindowManager;
+   friend class nuiWindowDecoration;
 
    void InitProperties();
 
Line 106
    nuiColor mBgColor[4]; // One color for each corner
    nuiImage* mpBackground; // Background image
 
-   nuiSize mClickX, mClickY; ///< Mouse coordinates captured from last click.
-   nuiRect mClickRect;   ///< Window rect captured from last click.
-   enum {
-     eNoMove,
-     ePreMove,
-     eMove
-   } mMoving;
    bool mModal; ///< True if the window is modal. Every window is modeless by default.
    bool mStaticChildren; ///< This flag is true if the children keep their original size and positions.
    bool mNoResize;
Line 122
    bool mNoMove;
    bool mRawWindow;
    nglString mTitle;
-   nuiButton* mpCloseButton;
-   nuiPosition mClickPos; ///< Indicate where the last click was (Center is inside the client area, Fill is the caption bar, the other values are the border if the window is resizable).
+
    nuiSize mMinimumHeight;
    nuiSize mMinimumWidth;
  private:
+   bool SetParent(nuiContainerPtr pParent) 
+   { 
+     return false; 
+   }
+   
    bool HandleCloseButtonPressed(nuiEvent* pEvent);
-
-   bool SetParent(nuiContainerPtr pParent) { return false; }
 
 
    nuiEventSink<nuiWindow> mNuiWindowSink;

nui/include/nuiWindowManager.h   1.1
Line 0
+ /*
+   NUI - C++ cross-platform GUI framework for OpenGL based applications
+   Copyright (C) 2002-2003 Sébastien Métrot
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+ #ifndef __nuiWindowManager_h__
+ #define __nuiWindowManager_h__
+
+ #include "nui.h"
+ #include "nuiTopLevel.h"
+ #include "nuiComposite.h"
+
+ class nuiWindow;
+ typedef nuiWindow* nuiWindowPtr;
+ class nuiWindowDecoration;
+
+ class nuiWindowManager : public nuiContainer
+ {
+ public:
+   nuiWindowManager(nuiContainerPtr pParent);
+   nuiWindowManager(nuiContainerPtr pParent, nuiXMLNode* pNode);
+   virtual ~nuiWindowManager();
+
+   virtual nuiXMLNode* Serialize(nuiXMLNode* pParentNode, bool Recursive);
+
+   /* @name Popup windows management */
+   //@{
+   // The Active window receives all the keyboard events and dipatches them to its widgets. It also is the top level window.
+   nuiWindow* GetActiveWindow(); ///< Return the current active popup window.
+   bool ActivateWindow(nuiWindow* pWindow); ///< Change the current active popup window.
+   bool IsParentActive(); ///< Allways true for the mainwindow!
+   uint GetWindowCount(); ///< Return the number of popup windows contained in the main window.
+   nuiWindow* GetWindow(uint index); ///< Return the window object with the given index rank in the list.
+   nuiWindow* GetWindow(nuiSize X, nuiSize Y, bool ClientAreaOnly = false); ///< Return the window object directly under the (X,Y) pixel. If \param ClientAreaOnly is true the window decorations are not taken into account when searching for the window.
+   //@}
+
+   virtual nuiWidgetPtr GetChild(nuiSize X, nuiSize Y); ///< Reimplemented from nuiContainer::GetChild
+   virtual nuiRect CalcIdealSize();
+   virtual bool SetRect(const nuiRect& rRect);
+
+   /* @name Events management */
+   //@{
+   virtual bool KeyDown     (nglKeyCode Key, nglChar Char);
+   virtual bool KeyUp       (nglKeyCode Key, nglChar Char);
+   virtual bool DispatchMouseClick  (nuiSize X, nuiSize Y, nglMouseInfo::Flags Button);
+   virtual bool DispatchMouseUnclick(nuiSize X, nuiSize Y, nglMouseInfo::Flags Button);
+   //@}
+
+   /* @name Background methods*/
+   //@{
+   void SetBackgroundColor(const nuiColor& rColor); ///< Set unique bg color.
+   //@}
+
+   /* @name Inherited from nuiWidget */
+   //@{
+   bool Draw(class nuiDrawContext *);
+   bool IsInsideLocal(nuiSize X, nuiSize Y);
+   bool AddChild(nuiWidgetPtr pChild);
+   bool DelChild(nuiWidgetPtr pChild, bool Delete = false);
+   //@}
+
+ private:
+   /** This class contains informations about each window contained in the window manager */
+   bool WindowFlagChanged(nuiEvent* pEvent);
+   std::list<nuiWindowDecoration*> mWindows;
+
+   nuiWindowDecoration* GetWindow(nuiWindow* pWindow);
+   nuiEventSink<nuiWindowManager> mWMSink;
+ };
+
+ class nuiWindowDecoration : public nuiComposite
+ {
+ public:
+ nuiWindowDecoration(nuiWindowManager* pParent, nuiWindow* pWindow);
+ virtual ~nuiWindowDecoration();
+
+ nuiWindow* GetWindow();
+
+   virtual bool Draw(class nuiDrawContext * pContext);
+   virtual nuiRect CalcIdealSize();
+   virtual bool ApplyWindowFlags(nuiEvent* pEvent);
+   virtual bool TargetRectChanged(nuiEvent* pEvent);
+   virtual bool HandleCloseButtonPressed(nuiEvent* pEvent);
+   virtual nuiRect GetRectFromFlags(const nuiRect& Rect, nuiWindowFlags flags);
+
+   virtual bool MouseClicked  (nuiSize X, nuiSize Y, nglMouseInfo::Flags Button);
+   virtual bool MouseUnclicked  (nuiSize X, nuiSize Y, nglMouseInfo::Flags Button);
+   virtual bool MouseMoved  (nuiSize X, nuiSize Y);
+   virtual bool SetRect(const nuiRect& rRect);
+ private:
+ nuiWindow* mpWindow;
+ nuiWidget* mpCloseButton;
+   nuiEventSink<nuiWindowDecoration> mWDSink;
+
+   nuiSize mClickX, mClickY; ///< Mouse coordinates captured from last click.
+   nuiRect mClickRect;   ///< Window rect captured from last click.
+   enum 
+   {
+     eNoMove,
+     ePreMove,
+     eMove
+   } mMoving;
+   nuiPosition mClickPos; ///< Indicate where the last click was (Center is inside the client area, Fill is the caption bar, the other values are the border if the window is resizable).
+ };
+
+
+
+ #endif __nuiWindowManager_h__
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]