]> git.mxchange.org Git - flightgear.git/commitdiff
Make it optional whether a dialog can be dragged or not.
authorehofman <ehofman>
Mon, 2 May 2005 12:14:12 +0000 (12:14 +0000)
committerehofman <ehofman>
Mon, 2 May 2005 12:14:12 +0000 (12:14 +0000)
docs-mini/README.gui
src/GUI/dialog.cxx
src/GUI/dialog.hxx

index 61542e4694dfa3766c75169d7c828561da358886..92fc492f6eabbb1b65cd2cd83002961189b12d69 100644 (file)
@@ -74,6 +74,7 @@ a simple, "hello world" dialog:
    <width>150</width>
    <height>100</height>
    <modal>false</modal>
+   <draggable>true</draggable>
 
    <text>
     <x>10</x>
@@ -152,6 +153,8 @@ file, since the root element is named PropertyList.
   modal - true if the dialog is modal (it blocks the rest of the
     program), false otherwise.  The default is false.
 
+  draggable - false if the dialog is not draggable. The default is true.
+
 Example:
 
 <PropertyList>
index e67f972eaae4ed86660039e345ac17ac192a0899..5c03b2d70d19ee90806f9e9f56e62ea6a5b8aa40 100644 (file)
@@ -15,6 +15,9 @@ int fgPopup::checkHit(int button, int updown, int x, int y)
 {
     int result = puPopup::checkHit(button, updown, x, y);
 
+    if ( !_draggable)
+       return result;
+
     // This is annoying.  We would really want a true result from the
     // superclass to indicate "handled by child object", but all it
     // tells us is that the pointer is inside the dialog.  So do the
@@ -405,10 +408,11 @@ FGDialog::makeObject (SGPropertyNode * props, int parentWidth, int parentHeight)
 
     if (type == "dialog") {
         puPopup * dialog;
+        bool draggable = props->getBoolValue("draggable", true);
         if (props->getBoolValue("modal", false))
             dialog = new puDialogBox(x, y);
         else
-            dialog = new fgPopup(x, y);
+            dialog = new fgPopup(x, y, draggable);
         setupGroup(dialog, props, width, height, color, true);
         return dialog;
     } else if (type == "group") {
index 0e3dc6c6f79eeaa8f1f4d1562ffd56711d40f92b..f081d88c0e4c07900a167a568f5b303d290daca7 100644 (file)
@@ -155,10 +155,11 @@ private:
 //
 class fgPopup : public puPopup {
 public:
-    fgPopup(int x, int y) : puPopup(x, y) { _dragging = false; }
+    fgPopup(int x, int y, bool d = true) : puPopup(x, y) { _dragging = false; _draggable = d;}
     int checkHit(int b, int up, int x, int y);
     int getHitObjects(puObject *, int x, int y);
 private:
+    bool _draggable;
     bool _dragging;
     int _dX, _dY;
 };