summaryrefslogtreecommitdiff
path: root/FL/Fl.H
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2014-01-21 13:29:15 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2014-01-21 13:29:15 +0000
commit1aba94f136b22af3629739d2681e7cff1fdcb8ea (patch)
tree77a12712e4a81e7fb10bffba699649cd41a62bb8 /FL/Fl.H
parent41b85d18a4c6e7cb4dd31f05705368b4e20667de (diff)
New method Fl::scheme_is(const char *name).
This is a convenience method to support easier implementation of scheme-specific code in draw() methods and elsewhere. Also improved Fl::scheme(const char *name) documentation. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10075 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl.H')
-rw-r--r--FL/Fl.H35
1 files changed, 33 insertions, 2 deletions
diff --git a/FL/Fl.H b/FL/Fl.H
index 5fd5c7fbd..614e01826 100644
--- a/FL/Fl.H
+++ b/FL/Fl.H
@@ -275,10 +275,41 @@ public:
static void background2(uchar, uchar, uchar);
// schemes:
- static int scheme(const char*);
+ static int scheme(const char *name);
/** See void scheme(const char *name) */
static const char* scheme() {return scheme_;}
- /**
+
+ /** Returns whether the current scheme is the given name.
+
+ This is a fast inline convenience function to support scheme-specific
+ code in widgets, e.g. in their draw() methods, if required.
+
+ Use a valid scheme name, not \p NULL (although \p NULL is allowed,
+ this is not a useful argument - see below).
+
+ If Fl::scheme() has not been set or has been set to the default
+ scheme ("none" or "base"), then this will always return 0 regardless
+ of the argument, because Fl::scheme() is \p NULL in this case.
+
+ \note The stored scheme name is always lowercase, and this method will
+ do a case-sensitive compare, so you \b must use a lowercase string to
+ return the correct value. This is intentional for performance reasons.
+
+ Example:
+ \code
+ if (Fl::scheme_is("gtk+")) { your_code_here(); }
+ \endcode
+
+ \param[in] name \b lowercase string of requested scheme name.
+
+ \return 1 if the given scheme is active, 0 otherwise.
+
+ \see Fl::scheme(const char *name)
+ */
+ static int scheme_is(const char *name) {
+ return (scheme_ && name && !strcmp(name,scheme_));
+ }
+ /**
Called by scheme according to scheme name.
Loads or reloads the current scheme selection.
See void scheme(const char *name)