summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-04-14 20:44:23 +0000
committerManolo Gouy <Manolo>2016-04-14 20:44:23 +0000
commit0e0ad95b22f5500c921a4a93ee26eff725a9455b (patch)
treefe8ef6658f78ec62a3bf900cb018b2be2ba83001 /src
parenta409f7c338d779b4ed473a27765b46cd4963edfa (diff)
Begin to rewrite Fl_Tree_Prefs.cxx under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11605 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Tree_Prefs.cxx106
-rw-r--r--src/drivers/Darwin/Fl_Darwin_System_Driver.H4
2 files changed, 73 insertions, 37 deletions
diff --git a/src/Fl_Tree_Prefs.cxx b/src/Fl_Tree_Prefs.cxx
index 1a7fcd591..08f124e1c 100644
--- a/src/Fl_Tree_Prefs.cxx
+++ b/src/Fl_Tree_Prefs.cxx
@@ -2,10 +2,6 @@
// "$Id$"
//
-#include <FL/Fl.H>
-#include <FL/Fl_Pixmap.H>
-#include <FL/Fl_Tree_Prefs.H>
-
//////////////////////
// Fl_Tree_Prefs.cxx
//////////////////////
@@ -24,11 +20,24 @@
// http://www.fltk.org/str.php
//
+#include "config_lib.h"
+
+#include <FL/Fl_System_Driver.H>
+#include <FL/Fl.H>
+#include <FL/Fl_Pixmap.H>
+#include <FL/Fl_Tree_Prefs.H>
+
+#ifdef FL_CFG_WIN_COCOA
+#include "drivers/Darwin/Fl_Darwin_System_Driver.H"
+#endif
+
// INTERNAL: BUILT IN OPEN/STOW XPMS
// These can be replaced via prefs.openicon()/closeicon()
//
-static const char * const L_open_xpm[] = {
-#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform look and feel
+
+#ifdef FL_CFG_WIN_COCOA
+
+const char * const Fl_Darwin_System_Driver::tree_open_xpm_darwin[] = {
"11 11 2 1",
". c None",
"@ c #000000",
@@ -43,28 +52,9 @@ static const char * const L_open_xpm[] = {
"...@@@.....",
"...@@......",
"...@......."
-#else /* __APPLE__ */ // PORTME: Fl_Screen_Driver - platform look and feel
- "11 11 3 1",
- ". c #fefefe",
- "# c #444444",
- "@ c #000000",
- "###########",
- "#.........#",
- "#.........#",
- "#....@....#",
- "#....@....#",
- "#..@@@@@..#",
- "#....@....#",
- "#....@....#",
- "#.........#",
- "#.........#",
- "###########"
-#endif /* __APPLE__ */ // PORTME: Fl_Screen_Driver - platform look and feel
};
-static Fl_Pixmap L_openpixmap(L_open_xpm);
-static const char * const L_close_xpm[] = {
-#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform look and feel
+const char * const Fl_Darwin_System_Driver::tree_close_xpm_darwin[] = {
"11 11 2 1",
". c None",
"@ c #000000",
@@ -79,7 +69,21 @@ static const char * const L_close_xpm[] = {
".....@.....",
"...........",
"..........."
-#else /* __APPLE__ */ // PORTME: Fl_Screen_Driver - platform look and feel
+};
+
+Fl_Pixmap *Fl_Darwin_System_Driver::tree_openpixmap() {
+ static Fl_Pixmap *pixmap = new Fl_Pixmap(tree_open_xpm_darwin);
+ return pixmap;
+}
+
+Fl_Pixmap *Fl_Darwin_System_Driver::tree_closepixmap() {
+ static Fl_Pixmap *pixmap = new Fl_Pixmap(tree_close_xpm_darwin);
+ return pixmap;
+}
+
+#endif // FL_CFG_WIN_COCOA
+
+const char * const Fl_System_Driver::tree_open_xpm[] = {
"11 11 3 1",
". c #fefefe",
"# c #444444",
@@ -87,17 +91,45 @@ static const char * const L_close_xpm[] = {
"###########",
"#.........#",
"#.........#",
- "#.........#",
- "#.........#",
+ "#....@....#",
+ "#....@....#",
"#..@@@@@..#",
- "#.........#",
- "#.........#",
+ "#....@....#",
+ "#....@....#",
"#.........#",
"#.........#",
"###########"
-#endif /* __APPLE__ */ // PORTME: Fl_Screen_Driver - platform look and feel
};
-static Fl_Pixmap L_closepixmap(L_close_xpm);
+
+const char * const Fl_System_Driver::tree_close_xpm[] = {
+"11 11 3 1",
+". c #fefefe",
+"# c #444444",
+"@ c #000000",
+"###########",
+"#.........#",
+"#.........#",
+"#.........#",
+"#.........#",
+"#..@@@@@..#",
+"#.........#",
+"#.........#",
+"#.........#",
+"#.........#",
+"###########"
+};
+
+
+Fl_Pixmap *Fl_System_Driver::tree_openpixmap() {
+ static Fl_Pixmap *pixmap = new Fl_Pixmap(tree_open_xpm);
+ return pixmap;
+}
+
+Fl_Pixmap *Fl_System_Driver::tree_closepixmap() {
+ static Fl_Pixmap *pixmap = new Fl_Pixmap(tree_close_xpm);
+ return pixmap;
+}
+
/// Sets the default icon to be used as the 'open' icon
/// when items are add()ed to the tree.
@@ -106,7 +138,7 @@ static Fl_Pixmap L_closepixmap(L_close_xpm);
/// \param[in] val -- The new image, or zero to use the default [+] icon.
///
void Fl_Tree_Prefs::openicon(Fl_Image *val) {
- _openimage = val ? val : &L_openpixmap;
+ _openimage = val ? val : Fl::system_driver()->tree_openpixmap();
// Update deactivated version of icon..
if ( _opendeimage ) delete _opendeimage;
if ( _openimage ) {
@@ -123,7 +155,7 @@ void Fl_Tree_Prefs::openicon(Fl_Image *val) {
/// \param[in] val -- The new image, or zero to use the default [-] icon.
///
void Fl_Tree_Prefs::closeicon(Fl_Image *val) {
- _closeimage = val ? val : &L_closepixmap;
+ _closeimage = val ? val : Fl::system_driver()->tree_closepixmap();
// Update deactivated version of icon..
if ( _closedeimage ) delete _closedeimage;
if ( _closeimage ) {
@@ -154,8 +186,8 @@ Fl_Tree_Prefs::Fl_Tree_Prefs() {
#else /* __APPLE__ */
_connectorstyle = FL_TREE_CONNECTOR_DOTTED;
#endif /* __APPLE__ */
- _openimage = &L_openpixmap;
- _closeimage = &L_closepixmap;
+ _openimage = Fl::system_driver()->tree_openpixmap();
+ _closeimage = Fl::system_driver()->tree_closepixmap();
_userimage = 0;
_opendeimage = _openimage->copy();
_opendeimage->inactive();
diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H
index 5622b90c9..f2434b9a7 100644
--- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H
+++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H
@@ -63,6 +63,10 @@ public:
virtual const char *latin1_to_local(const char *t, int n);
virtual const char *local_to_mac_roman(const char *t, int n);
virtual const char *mac_roman_to_local(const char *t, int n);
+ virtual Fl_Pixmap *tree_openpixmap();
+ static const char * const tree_open_xpm_darwin[]; // used by tree_openpixmap()
+ virtual Fl_Pixmap *tree_closepixmap();
+ static const char * const tree_close_xpm_darwin[]; // used by tree_closepixmap()
};
#endif // FL_DARWIN_SYSTEM_DRIVER_H