summaryrefslogtreecommitdiff
path: root/src/Fl.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-10-31 22:39:40 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-10-31 22:39:40 +0000
commit5560a4f0f1f5b4799a8c5162212e7ec22c601ae5 (patch)
tree42be986576fa49dabfe7ba33af6eeb893c3ebff5 /src/Fl.cxx
parent1e26ada2c5be6bf9ca45884bebc0228319c3c226 (diff)
Fixed a few pedantic warnings. Added Fl::option as discussed in STR #2368, but I am not too happy with it yet. Please see discussion in that STR.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7789 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl.cxx')
-rw-r--r--src/Fl.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 9ebf023f6..b855f487f 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -85,6 +85,10 @@ int Fl::e_length;
int Fl::visible_focus_ = 1,
Fl::dnd_text_ops_ = 1;
+unsigned char Fl::options_[] = { 0, 0 };
+unsigned char Fl::options_read_ = 0;
+
+
Fl_Window *fl_xfocus; // which window X thinks has focus
Fl_Window *fl_xmousewin;// which window X thinks has FL_ENTER
Fl_Window *Fl::grab_; // most recent Fl::grab()
@@ -1734,6 +1738,33 @@ void Fl::clear_widget_pointer(Fl_Widget const *w)
}
}
+
+bool Fl::option(Fl_Option o)
+{
+ if (!options_read_) {
+ int tmp;
+ { // first, read the system wide preferences
+ Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk");
+ Fl_Preferences opt(prefs, "options");
+ prefs.get("ArrowFocus", tmp, 0); options_[OPTION_ARROW_FOCUS] = tmp;
+ prefs.get("NativeFilechooser", tmp, 0); options_[OPTION_NATIVE_FILECHOOSER] = tmp;
+ }
+ { // next, check the user preferences
+ Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
+ Fl_Preferences opt(prefs, "options");
+ prefs.get("ArrowFocus", tmp, 0); options_[OPTION_ARROW_FOCUS] = tmp;
+ prefs.get("NativeFilechooser", tmp, 0); options_[OPTION_NATIVE_FILECHOOSER] = tmp;
+ }
+ { // now, if the developer has registered this app, we could as for per-application preferences
+ }
+ options_read_ = 1;
+ }
+ if (o<0 || o>=OPTION_LAST)
+ return false;
+ return (bool)options_[o];
+}
+
+
// Helper class Fl_Widget_Tracker
/**
@@ -1753,6 +1784,7 @@ Fl_Widget_Tracker::~Fl_Widget_Tracker() {
Fl::release_widget_pointer(wp_); // remove pointer from watch list
}
+
//
// End of "$Id$".
//