Code: Select all
Index: include/IGUIWindow.h
===================================================================
--- include/IGUIWindow.h (Revision 2236)
+++ include/IGUIWindow.h (Arbeitskopie)
@@ -31,6 +31,12 @@
//! Returns pointer to the maximize button
virtual IGUIButton* getMaximizeButton() const = 0;
+
+ //! Enables dragging for the window
+ virtual void setDraggingEnabled(bool enable) = 0;
+
+ //! Checks if the window can be dragged
+ virtual bool isDraggingEnabled() const = 0;
};
Index: source/Irrlicht/CGUIWindow.cpp
===================================================================
--- source/Irrlicht/CGUIWindow.cpp (Revision 2236)
+++ source/Irrlicht/CGUIWindow.cpp (Arbeitskopie)
@@ -19,7 +19,7 @@
//! constructor
CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
-: IGUIWindow(environment, parent, id, rectangle), Dragging(false)
+: IGUIWindow(environment, parent, id, rectangle), Dragging(false), IsDragginEnabled(true)
{
#ifdef _DEBUG
setDebugName("CGUIWindow");
@@ -171,7 +171,7 @@
if ( !event.MouseInput.isLeftPressed() )
Dragging = false;
- if (Dragging)
+ if (Dragging && IsDragginEnabled)
{
// gui window should not be dragged outside its parent
if (Parent &&
@@ -258,7 +258,17 @@
return RestoreButton;
}
+void CGUIWindow::setDraggingEnabled( bool enable )
+{
+ IsDragginEnabled = enable;
+}
+
+bool CGUIWindow::isDraggingEnabled() const
+{
+ return IsDragginEnabled;
+}
+
} // end namespace gui
} // end namespace irr
Index: source/Irrlicht/CGUIWindow.h
===================================================================
--- source/Irrlicht/CGUIWindow.h (Revision 2236)
+++ source/Irrlicht/CGUIWindow.h (Arbeitskopie)
@@ -44,6 +44,12 @@
//! Returns pointer to the maximize button
virtual IGUIButton* getMaximizeButton() const;
+ //! Enables dragging for the window
+ virtual void setDraggingEnabled(bool enable);
+
+ //! Checks if the window can be dragged
+ virtual bool isDraggingEnabled() const;
+
protected:
IGUIButton* CloseButton;
@@ -52,6 +58,7 @@
core::position2d<s32> DragStart;
bool Dragging;
+ bool IsDragginEnabled;
};
} // end namespace gui