diff -r 693898d8450a lib/irrlicht/include/IGUIWindow.h --- a/lib/irrlicht/include/IGUIWindow.h Tue Sep 09 01:28:23 2008 +0200 +++ b/lib/irrlicht/include/IGUIWindow.h Tue Sep 09 02:33:57 2008 +0200 @@ -35,6 +35,25 @@ //! return if given construction flag is set virtual bool hasConstructionFlag( EWINDOW_CONSTRUCTION_FLAG flag ) const = 0; + + //! Set if the window can be dragged around by the mouse + virtual void setDraggable(bool draggable) = 0; + + //! Check if the windows can be dragged around by the mouse + virtual bool isDraggable() const = 0; + + //! Set if the window background will be drawn + virtual void setDrawBackground(bool draw) = 0; + + //! Get if the window background will be drawn + virtual bool getDrawBackground() const = 0; + + //! Set if the window titlebar will be drawn + //! Note: If the backround is not drawn, then the titlebar is automatically also not drawn + virtual void setDrawTitlebar(bool draw) = 0; + + //! Get if the window titlebar will be drawn + virtual bool getDrawTitlebar() const = 0; }; diff -r 693898d8450a lib/irrlicht/source/Irrlicht/CGUIWindow.cpp --- a/lib/irrlicht/source/Irrlicht/CGUIWindow.cpp Tue Sep 09 01:28:23 2008 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIWindow.cpp Tue Sep 09 02:33:57 2008 +0200 @@ -23,6 +23,8 @@ , ConstructionFlags(constructionFlags) , Dragging(false) , CloseButton(NULL) , MinButton(NULL), RestoreButton(NULL) +, IsDraggable(true) +, DrawBackground(true), DrawTitlebar(true) { #ifdef _DEBUG setDebugName("CGUIWindow"); @@ -147,7 +149,10 @@ case EET_GUI_EVENT: if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST) { - Dragging = false; + if ( event.GUIEvent.Caller == this ) + { + Dragging = false; + } } else if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUSED) @@ -209,8 +214,10 @@ return true; - - move(core::position2d(event.MouseInput.X - DragStart.X, event.MouseInput.Y - DragStart.Y)); + if ( isDraggable() ) + { + move(core::position2d(event.MouseInput.X - DragStart.X, event.MouseInput.Y - DragStart.Y)); + } DragStart.X = event.MouseInput.X; DragStart.Y = event.MouseInput.Y; return true; @@ -247,18 +254,21 @@ core::rect *cl = &AbsoluteClippingRect; // draw body fast - rect = skin->draw3DWindowBackground(this, true, skin->getColor(EGDC_ACTIVE_BORDER), - AbsoluteRect, &AbsoluteClippingRect); + if ( getDrawBackground() ) + { + rect = skin->draw3DWindowBackground(this, DrawTitlebar, skin->getColor(EGDC_ACTIVE_BORDER), + AbsoluteRect, &AbsoluteClippingRect); - if (Text.size()) - { - rect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X); - rect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y); - rect.LowerRightCorner.X -= skin->getSize(EGDS_WINDOW_BUTTON_WIDTH) + 5; - - IGUIFont* font = skin->getFont(EGDF_WINDOW); - if (font) - font->draw(Text.c_str(), rect, skin->getColor(EGDC_ACTIVE_CAPTION), false, true, cl); + if (DrawTitlebar && Text.size() ) + { + rect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X); + rect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y); + rect.LowerRightCorner.X -= skin->getSize(EGDS_WINDOW_BUTTON_WIDTH) + 5; + + IGUIFont* font = skin->getFont(EGDF_WINDOW); + if (font) + font->draw(Text.c_str(), rect, skin->getColor(EGDC_ACTIVE_CAPTION), false, true, cl); + } } IGUIElement::draw(); @@ -283,6 +293,45 @@ IGUIButton* CGUIWindow::getMaximizeButton() const { return RestoreButton; +} + +//! Set if the window can be dragged around by the mouse +void CGUIWindow::setDraggable(bool draggable) +{ + IsDraggable = draggable; + + if ( !IsDraggable ) + Dragging = false; +} + +//! Check if the windows can be dragged around by the mouse +bool CGUIWindow::isDraggable() const +{ + return IsDraggable; +} + +//! Set if the window background will be drawn +void CGUIWindow::setDrawBackground(bool draw) +{ + DrawBackground = draw; +} + +//! Get if the window background will be drawn +bool CGUIWindow::getDrawBackground() const +{ + return DrawBackground; +} + +//! Set if the window titlebar will be drawn +void CGUIWindow::setDrawTitlebar(bool draw) +{ + DrawTitlebar = draw; +} + +//! Get if the window titlebar will be drawn +bool CGUIWindow::getDrawTitlebar() const +{ + return DrawTitlebar; } @@ -296,6 +345,9 @@ //IGUIButton* RestoreButton; // exists at whole lifetime of the object out->addInt ("ConstructionFlags", ConstructionFlags ); + out->addBool("IsDraggable", IsDraggable); + out->addBool("DrawBackground", DrawBackground); + out->addBool("DrawTitlebar", DrawTitlebar); } @@ -305,6 +357,9 @@ IGUIWindow::deserializeAttributes(in, options); ConstructionFlags = in->getAttributeAsInt("ConstructionFlags"); + setDraggable( in->getAttributeAsBool("IsDraggable") ); + setDrawBackground( in->getAttributeAsBool("DrawBackground") ); + setDrawTitlebar( in->getAttributeAsBool("DrawTitlebar") ); refreshControls(); } diff -r 693898d8450a lib/irrlicht/source/Irrlicht/CGUIWindow.h --- a/lib/irrlicht/source/Irrlicht/CGUIWindow.h Tue Sep 09 01:28:23 2008 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIWindow.h Tue Sep 09 02:33:57 2008 +0200 @@ -47,6 +47,25 @@ //! return if given flag is set virtual bool hasConstructionFlag( EWINDOW_CONSTRUCTION_FLAG flag ) const; + //! Set if the window can be dragged around by the mouse + virtual void setDraggable(bool draggable); + + //! Check if the windows can be dragged around by the mouse + virtual bool isDraggable() const; + + //! Set if the window background will be drawn + virtual void setDrawBackground(bool draw); + + //! Get if the window background will be drawn + virtual bool getDrawBackground() const; + + //! Set if the window titlebar will be drawn + //! Note: If the backround is not drawn, then the titlebar is automatically also not drawn + virtual void setDrawTitlebar(bool draw); + + //! Get if the window titlebar will be drawn + virtual bool getDrawTitlebar() const; + //! Writes attributes of the element. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const; @@ -64,6 +83,10 @@ IGUIButton* CloseButton; IGUIButton* MinButton; IGUIButton* RestoreButton; + + bool IsDraggable; + bool DrawBackground; + bool DrawTitlebar; }; } // end namespace gui