Rewrite Fl_Window::show(int argc, char **argv) under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11413 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
d3b33cdaea
commit
abc12cd376
@ -98,6 +98,8 @@ public:
|
|||||||
virtual void iconize() {}
|
virtual void iconize() {}
|
||||||
virtual void decoration_sizes(int *top, int *left, int *right, int *bottom) {
|
virtual void decoration_sizes(int *top, int *left, int *right, int *bottom) {
|
||||||
*top = *left = *right = *bottom = 0; }
|
*top = *left = *right = *bottom = 0; }
|
||||||
|
virtual void show_with_args_begin() {}
|
||||||
|
virtual void show_with_args_end(int argc, char **argv) {}
|
||||||
|
|
||||||
// --- window shape stuff
|
// --- window shape stuff
|
||||||
void shape_pixmap_(Fl_Image* pixmap); // TODO: check
|
void shape_pixmap_(Fl_Image* pixmap); // TODO: check
|
||||||
@ -111,7 +113,7 @@ public:
|
|||||||
virtual void free_icons() {} // TODO: check
|
virtual void free_icons() {} // TODO: check
|
||||||
|
|
||||||
// --- window printing helper
|
// --- window printing helper
|
||||||
virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right); // TODO: check
|
virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,8 @@
|
|||||||
// You do not need to call this! Feel free to make up your own switches.
|
// You do not need to call this! Feel free to make up your own switches.
|
||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/x.H>
|
|
||||||
#include <FL/Fl_Window.H>
|
#include <FL/Fl_Window.H>
|
||||||
|
#include <FL/Fl_Window_Driver.H>
|
||||||
#include <FL/Fl_Tooltip.H>
|
#include <FL/Fl_Tooltip.H>
|
||||||
#include <FL/filename.H>
|
#include <FL/filename.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
@ -301,32 +301,7 @@ void Fl_Window::show(int argc, char **argv) {
|
|||||||
|
|
||||||
Fl::get_system_colors();
|
Fl::get_system_colors();
|
||||||
|
|
||||||
#if defined(WIN32)
|
pWindowDriver->show_with_args_begin();
|
||||||
#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver- platform default parameters
|
|
||||||
#elif defined(FL_PORTING)
|
|
||||||
# pragma message "FL_PORTING: Parse additional default settings"
|
|
||||||
#else // X11
|
|
||||||
// Get defaults for drag-n-drop and focus...
|
|
||||||
const char *key = 0, *val;
|
|
||||||
|
|
||||||
if (Fl::first_window()) key = Fl::first_window()->xclass();
|
|
||||||
if (!key) key = "fltk";
|
|
||||||
|
|
||||||
val = XGetDefault(fl_display, key, "dndTextOps");
|
|
||||||
if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 ||
|
|
||||||
strcasecmp(val, "on") == 0 ||
|
|
||||||
strcasecmp(val, "yes") == 0);
|
|
||||||
|
|
||||||
val = XGetDefault(fl_display, key, "tooltips");
|
|
||||||
if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 ||
|
|
||||||
strcasecmp(val, "on") == 0 ||
|
|
||||||
strcasecmp(val, "yes") == 0);
|
|
||||||
|
|
||||||
val = XGetDefault(fl_display, key, "visibleFocus");
|
|
||||||
if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
|
|
||||||
strcasecmp(val, "on") == 0 ||
|
|
||||||
strcasecmp(val, "yes") == 0);
|
|
||||||
#endif // !WIN32 && !__APPLE__ // PORTME: platform defaults
|
|
||||||
|
|
||||||
// set colors first, so background_pixel is correct:
|
// set colors first, so background_pixel is correct:
|
||||||
static char beenhere;
|
static char beenhere;
|
||||||
@ -365,21 +340,7 @@ void Fl_Window::show(int argc, char **argv) {
|
|||||||
// Show the window AFTER we have set the colors and scheme.
|
// Show the window AFTER we have set the colors and scheme.
|
||||||
show();
|
show();
|
||||||
|
|
||||||
#if defined(WIN32)
|
pWindowDriver->show_with_args_end(argc, argv);
|
||||||
#elif defined(__APPLE__) // PORTME: Fl_System_Driver - platform properties
|
|
||||||
#elif defined(FL_PORTING)
|
|
||||||
# pragma message "FL_PORTING: Parse additional default settings"
|
|
||||||
#else // X11
|
|
||||||
// set the command string, used by state-saving window managers:
|
|
||||||
int j;
|
|
||||||
int n=0; for (j=0; j<argc; j++) n += strlen(argv[j])+1;
|
|
||||||
char *buffer = new char[n];
|
|
||||||
char *p = buffer;
|
|
||||||
for (j=0; j<argc; j++) for (const char *q = argv[j]; (*p++ = *q++););
|
|
||||||
XChangeProperty(fl_display, fl_xid(this), XA_WM_COMMAND, XA_STRING, 8, 0,
|
|
||||||
(unsigned char *)buffer, p-buffer-1);
|
|
||||||
delete[] buffer;
|
|
||||||
#endif // !WIN32 && !__APPLE__ // PORTME: Fl_System_Driver - platform properties
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calls useful for simple demo programs, with automatic help message:
|
// Calls useful for simple demo programs, with automatic help message:
|
||||||
|
|||||||
@ -100,6 +100,8 @@ public:
|
|||||||
virtual void size_range();
|
virtual void size_range();
|
||||||
virtual void iconize();
|
virtual void iconize();
|
||||||
virtual void decoration_sizes(int *top, int *left, int *right, int *bottom);
|
virtual void decoration_sizes(int *top, int *left, int *right, int *bottom);
|
||||||
|
virtual void show_with_args_begin();
|
||||||
|
virtual void show_with_args_end(int argc, char **argv);
|
||||||
|
|
||||||
virtual void shape(const Fl_Image* img);
|
virtual void shape(const Fl_Image* img);
|
||||||
virtual void icons(const Fl_RGB_Image *icons[], int count);
|
virtual void icons(const Fl_RGB_Image *icons[], int count);
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
#include <FL/Fl_Shared_Image.H>
|
#include <FL/Fl_Shared_Image.H>
|
||||||
#include <FL/Fl_Overlay_Window.H>
|
#include <FL/Fl_Overlay_Window.H>
|
||||||
#include <FL/Fl_Menu_Window.H>
|
#include <FL/Fl_Menu_Window.H>
|
||||||
|
#include <FL/Fl_Tooltip.H>
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
#include <FL/fl_ask.H>
|
#include <FL/fl_ask.H>
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
@ -517,6 +518,42 @@ void Fl_X11_Window_Driver::decoration_sizes(int *top, int *left, int *right, in
|
|||||||
*bottom = 8;
|
*bottom = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Fl_X11_Window_Driver::show_with_args_begin() {
|
||||||
|
// Get defaults for drag-n-drop and focus...
|
||||||
|
const char *key = 0, *val;
|
||||||
|
|
||||||
|
if (Fl::first_window()) key = Fl::first_window()->xclass();
|
||||||
|
if (!key) key = "fltk";
|
||||||
|
|
||||||
|
val = XGetDefault(fl_display, key, "dndTextOps");
|
||||||
|
if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 ||
|
||||||
|
strcasecmp(val, "on") == 0 ||
|
||||||
|
strcasecmp(val, "yes") == 0);
|
||||||
|
|
||||||
|
val = XGetDefault(fl_display, key, "tooltips");
|
||||||
|
if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 ||
|
||||||
|
strcasecmp(val, "on") == 0 ||
|
||||||
|
strcasecmp(val, "yes") == 0);
|
||||||
|
|
||||||
|
val = XGetDefault(fl_display, key, "visibleFocus");
|
||||||
|
if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
|
||||||
|
strcasecmp(val, "on") == 0 ||
|
||||||
|
strcasecmp(val, "yes") == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Fl_X11_Window_Driver::show_with_args_end(int argc, char **argv) {
|
||||||
|
// set the command string, used by state-saving window managers:
|
||||||
|
int j;
|
||||||
|
int n=0; for (j=0; j<argc; j++) n += strlen(argv[j])+1;
|
||||||
|
char *buffer = new char[n];
|
||||||
|
char *p = buffer;
|
||||||
|
for (j=0; j<argc; j++) for (const char *q = argv[j]; (*p++ = *q++););
|
||||||
|
XChangeProperty(fl_display, fl_xid(pWindow), XA_WM_COMMAND, XA_STRING, 8, 0,
|
||||||
|
(unsigned char *)buffer, p-buffer-1);
|
||||||
|
delete[] buffer;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id$".
|
// End of "$Id$".
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user