Author: AlbrechtS
Date: 2011-02-12 03:31:40 -0800 (Sat, 12 Feb 2011)
New Revision: 8415
Log:
Hotspot behavior of fl_message() and other common dialogs is now
optional (STR #2561).
Modified:
branches/branch-1.3/CHANGES
branches/branch-1.3/FL/fl_ask.H
branches/branch-1.3/src/fl_ask.cxx
Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2011-02-12 09:34:57 UTC (rev 8414)
+++ branches/branch-1.3/CHANGES 2011-02-12 11:31:40 UTC (rev 8415)
@@ -52,6 +52,8 @@
- Added support for shortcuts for Fl_Input_, Fl_Value_Input, and
Fl_Text_Display derived widgets (STR #1770)
- Added Fl_Menu_ methods: insert(), find_index(), clear_submenu()
+ - Hotspot behavior of fl_message() and other common dialogs is now
+ optional (STR #2561).
IDE support and command line build options
Modified: branches/branch-1.3/FL/fl_ask.H
===================================================================
--- branches/branch-1.3/FL/fl_ask.H 2011-02-12 09:34:57 UTC (rev 8414)
+++ branches/branch-1.3/FL/fl_ask.H 2011-02-12 11:31:40 UTC (rev 8415)
@@ -64,6 +64,9 @@
inline void fl_message_font(Fl_Font f, Fl_Fontsize s) {
fl_message_font_ = f; fl_message_size_ = s;}
+FL_EXPORT void fl_message_hotspot(int enable);
+FL_EXPORT int fl_message_hotspot(void);
+
// pointers you can use to change FLTK to a foreign language:
extern FL_EXPORT const char* fl_no;
extern FL_EXPORT const char* fl_yes;
Modified: branches/branch-1.3/src/fl_ask.cxx
===================================================================
--- branches/branch-1.3/src/fl_ask.cxx 2011-02-12 09:34:57 UTC (rev 8414)
+++ branches/branch-1.3/src/fl_ask.cxx 2011-02-12 11:31:40 UTC (rev 8415)
@@ -56,6 +56,7 @@
static const char *iconlabel = "?";
Fl_Font fl_message_font_ = FL_HELVETICA;
Fl_Fontsize fl_message_size_ = -1;
+static int enableHotspot = 1;
#ifdef __APPLE__
extern "C" void NSBeep(void);
#endif
@@ -78,7 +79,7 @@
message_form->size(410,103);
return message_form;
}
- // make sure that the dialog does not become the child of some
+ // make sure that the dialog does not become the child of some
// current group
Fl_Group *previously_current_group = Fl_Group::current();
Fl_Group::current(0);
@@ -226,9 +227,10 @@
resizeform();
- if (button[1]->visible() && !input->visible())
+ if (button[1]->visible() && !input->visible())
button[1]->take_focus();
- message_form->hotspot(button[0]);
+ if (enableHotspot)
+ message_form->hotspot(button[0]);
if (b0 && Fl_Widget::label_shortcut(b0))
button[0]->shortcut(0);
else
@@ -290,7 +292,7 @@
break;
default :
break;
- }
+ }
#else
switch (type) {
case FL_BEEP_DEFAULT :
@@ -408,11 +410,11 @@
va_end(ap);
return r;
}
-/** Gets the Fl_Box icon container of the current default dialog used in
- many common dialogs like fl_message(), fl_alert(),
- fl_ask(), fl_choice(), fl_input(), fl_password()
+/** Gets the Fl_Box icon container of the current default dialog used in
+ many common dialogs like fl_message(), fl_alert(),
+ fl_ask(), fl_choice(), fl_input(), fl_password()
\note \#include <FL/fl_ask.H>
-*/
+*/
Fl_Widget *fl_message_icon() {makeform(); return icon;}
static const char* input_innards(const char* fmt, va_list ap,
@@ -479,6 +481,33 @@
return r;
}
+/** Sets whether or not to move the common message box used in
+ many common dialogs like fl_message(), fl_alert(),
+ fl_ask(), fl_choice(), fl_input(), fl_password() to follow
+ the mouse pointer.
+
+ The default is \e enabled, so that the default button is the
+ hotspot and appears at the mouse position.
+ \note \#include <FL/fl_ask.H>
+ \param[in] enable non-zero enables hotspot behavior,
+ 0 disables hotspot
+ */
+void fl_message_hotspot(int enable) {
+ enableHotspot = enable ? 1 : 0;
+}
+
+/** Gets whether or not to move the common message box used in
+ many common dialogs like fl_message(), fl_alert(),
+ fl_ask(), fl_choice(), fl_input(), fl_password() to follow
+ the mouse pointer.
+ \note \#include <FL/fl_ask.H>
+ \return 0 if disable, non-zero otherwise
+ \see fl_message_hotspot(int)
+ */
+int fl_message_hotspot(void) {
+ return enableHotspot;
+}
+
/** @} */
//
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit