diff --git a/docs-mini/README.gui b/docs-mini/README.gui index 61542e469..92fc492f6 100644 --- a/docs-mini/README.gui +++ b/docs-mini/README.gui @@ -74,6 +74,7 @@ a simple, "hello world" dialog: 150 100 false + true 10 @@ -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: diff --git a/src/GUI/dialog.cxx b/src/GUI/dialog.cxx index e67f972ea..5c03b2d70 100644 --- a/src/GUI/dialog.cxx +++ b/src/GUI/dialog.cxx @@ -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") { diff --git a/src/GUI/dialog.hxx b/src/GUI/dialog.hxx index 0e3dc6c6f..f081d88c0 100644 --- a/src/GUI/dialog.hxx +++ b/src/GUI/dialog.hxx @@ -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; };