Rewrite Fl_Window::show() and Fl_Menu_Window::show() under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11400 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
6302b3da00
commit
6ec8ebc4f8
@ -77,6 +77,8 @@ public:
|
||||
virtual Fl_X *makeWindow() { /* FIXME: move Fl_X::make(Fl_Window*) here for OSX, MSWin, and X11 */ return 0; }
|
||||
virtual void wait_for_expose() {} // TODO: check
|
||||
virtual void destroy_double_buffer(); // TODO: check
|
||||
virtual void show();
|
||||
virtual void show_menu();
|
||||
|
||||
// --- window shape stuff
|
||||
void shape_pixmap_(Fl_Image* pixmap); // TODO: check
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl_Menu_Window.H>
|
||||
#include <FL/Fl_Window_Driver.H>
|
||||
|
||||
// WIN32 note: HAVE_OVERLAY is false
|
||||
#if HAVE_OVERLAY
|
||||
@ -41,15 +42,7 @@ extern uchar fl_overlay; // changes how fl_color(x) works
|
||||
#include <stdio.h>
|
||||
|
||||
void Fl_Menu_Window::show() {
|
||||
#if HAVE_OVERLAY
|
||||
if (!shown() && overlay() && fl_find_overlay_visual()) {
|
||||
XInstallColormap(fl_display, fl_overlay_colormap);
|
||||
fl_background_pixel = int(fl_transparent_pixel);
|
||||
Fl_X::make_xid(this, fl_overlay_visual, fl_overlay_colormap);
|
||||
fl_background_pixel = -1;
|
||||
} else
|
||||
#endif
|
||||
Fl_Single_Window::show();
|
||||
driver()->show_menu();
|
||||
}
|
||||
|
||||
void Fl_Menu_Window::flush() {
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <FL/Fl_Window_Driver.H>
|
||||
#include <FL/Fl_RGB_Image.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Tooltip.H>
|
||||
#include <stdlib.h>
|
||||
#include "flstring.h"
|
||||
|
||||
@ -493,6 +494,18 @@ void Fl_Window::label(const char *name, const char *mininame) {
|
||||
pWindowDriver->label(name, mininame);
|
||||
}
|
||||
|
||||
void Fl_Window::show() {
|
||||
image(Fl::scheme_bg_);
|
||||
if (Fl::scheme_bg_) {
|
||||
labeltype(FL_NORMAL_LABEL);
|
||||
align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
|
||||
} else {
|
||||
labeltype(FL_NO_LABEL);
|
||||
}
|
||||
Fl_Tooltip::exit(this);
|
||||
pWindowDriver->show();
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
@ -41,10 +41,16 @@ int Fl_Window_Driver::maxh() {return pWindow->maxh;}
|
||||
unsigned char Fl_Window_Driver::size_range_set() {return pWindow->size_range_set;}
|
||||
|
||||
void Fl_Window_Driver::flush_single() { pWindow->Fl_Window::flush(); }
|
||||
void Fl_Window_Driver::draw() { pWindow->draw(); }
|
||||
void Fl_Window_Driver::make_current() { }
|
||||
void Fl_Window_Driver::label(const char *name, const char *mininame) {}
|
||||
|
||||
void Fl_Window_Driver::draw() { pWindow->draw(); }
|
||||
|
||||
void Fl_Window_Driver::make_current() { }
|
||||
|
||||
void Fl_Window_Driver::show() { }
|
||||
|
||||
void Fl_Window_Driver::show_menu() { pWindow->Fl_Window::show(); }
|
||||
|
||||
void Fl_Window_Driver::label(const char *name, const char *mininame) {}
|
||||
|
||||
void Fl_Window_Driver::take_focus()
|
||||
{
|
||||
|
@ -3145,21 +3145,14 @@ void Fl_Cocoa_Window_Driver::label(const char *name, const char *mininame) {
|
||||
/*
|
||||
* make a window visible
|
||||
*/
|
||||
void Fl_Window::show() {
|
||||
image(Fl::scheme_bg_);
|
||||
if (Fl::scheme_bg_) {
|
||||
labeltype(FL_NORMAL_LABEL);
|
||||
align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
|
||||
} else {
|
||||
labeltype(FL_NO_LABEL);
|
||||
}
|
||||
Fl_Tooltip::exit(this);
|
||||
void Fl_Cocoa_Window_Driver::show() {
|
||||
Fl_X *top = NULL;
|
||||
if (parent()) top = top_window()->i;
|
||||
if (!shown() && (!parent() || (top && ![top->xid isMiniaturized]))) {
|
||||
Fl_X::make(this);
|
||||
if (pWindow->parent()) top = Fl_X::i(pWindow->top_window());
|
||||
if (!pWindow->shown() && (!pWindow->parent() || (top && ![top->xid isMiniaturized]))) {
|
||||
Fl_X::make(pWindow);
|
||||
} else {
|
||||
if ( !parent() ) {
|
||||
if ( !pWindow->parent() ) {
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if ([i->xid isMiniaturized]) {
|
||||
i->w->redraw();
|
||||
[i->xid deminiaturize:nil];
|
||||
@ -3168,7 +3161,7 @@ void Fl_Window::show() {
|
||||
[i->xid makeKeyAndOrderFront:nil];
|
||||
}
|
||||
}
|
||||
else set_visible();
|
||||
else pWindow->set_visible();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2277,20 +2277,13 @@ int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) {
|
||||
// Fl_Widget *fl_boxcheat;
|
||||
//static inline int can_boxcheat(uchar b) {return (b==1 || (b&2) && b<=15);}
|
||||
|
||||
void Fl_Window::show() {
|
||||
image(Fl::scheme_bg_);
|
||||
if (Fl::scheme_bg_) {
|
||||
labeltype(FL_NORMAL_LABEL);
|
||||
align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
|
||||
} else {
|
||||
labeltype(FL_NO_LABEL);
|
||||
}
|
||||
Fl_Tooltip::exit(this);
|
||||
if (!shown()) {
|
||||
void Fl_WinAPI_Window_Driver::show() {
|
||||
if (!pWindow->shown()) {
|
||||
// if (can_boxcheat(box())) fl_background_pixel = fl_xpixel(color());
|
||||
Fl_X::make(this);
|
||||
Fl_X::make(pWindow);
|
||||
} else {
|
||||
// Once again, we would lose the capture if we activated the window.
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (IsIconic(i->xid)) OpenIcon(i->xid);
|
||||
if (!fl_capture) BringWindowToTop(i->xid);
|
||||
//ShowWindow(i->xid,fl_capture?SW_SHOWNOACTIVATE:SW_RESTORE);
|
||||
|
38
src/Fl_x.cxx
38
src/Fl_x.cxx
@ -2901,29 +2901,17 @@ void Fl_X11_Window_Driver::label(const char *name, const char *iname) {
|
||||
// Fl_Window *fl_boxcheat;
|
||||
static inline int can_boxcheat(uchar b) {return (b==1 || ((b&2) && b<=15));}
|
||||
|
||||
void Fl_Window::show() {
|
||||
image(Fl::scheme_bg_);
|
||||
if (Fl::scheme_bg_) {
|
||||
labeltype(FL_NORMAL_LABEL);
|
||||
align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
|
||||
} else {
|
||||
labeltype(FL_NO_LABEL);
|
||||
}
|
||||
Fl_Tooltip::exit(this);
|
||||
if (!shown()) {
|
||||
void Fl_X11_Window_Driver::show() {
|
||||
if (!pWindow->shown()) {
|
||||
fl_open_display();
|
||||
// Don't set background pixel for double-buffered windows...
|
||||
if (type() != FL_DOUBLE_WINDOW && can_boxcheat(box())) {
|
||||
fl_background_pixel = int(fl_xpixel(color()));
|
||||
if (pWindow->type() != FL_DOUBLE_WINDOW && can_boxcheat(pWindow->box())) {
|
||||
fl_background_pixel = int(fl_xpixel(pWindow->color()));
|
||||
}
|
||||
Fl_X::make_xid(this);
|
||||
Fl_X::make_xid(pWindow);
|
||||
} else {
|
||||
XMapRaised(fl_display, i->xid);
|
||||
XMapRaised(fl_display, fl_xid(pWindow));
|
||||
}
|
||||
#ifdef USE_PRINT_BUTTON
|
||||
void preparePrintFront(void);
|
||||
preparePrintFront();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -2932,11 +2920,13 @@ FL_EXPORT Window fl_xid_(const Fl_Window *w) {
|
||||
return temp ? temp->xid : 0;
|
||||
}
|
||||
|
||||
//#define USE_PRINT_BUTTON 1
|
||||
#ifdef USE_PRINT_BUTTON
|
||||
|
||||
// to test the Fl_Printer class creating a "Print front window" button in a separate window
|
||||
// contains also preparePrintFront call above
|
||||
#include <FL/Fl_Printer.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
|
||||
void printFront(Fl_Widget *o, void *data)
|
||||
{
|
||||
Fl_Printer printer;
|
||||
@ -2987,11 +2977,7 @@ void copyFront(Fl_Widget *o, void *data)
|
||||
o->window()->show();
|
||||
}
|
||||
|
||||
void preparePrintFront(void)
|
||||
{
|
||||
static int first=1;
|
||||
if(!first) return;
|
||||
first=0;
|
||||
static int prepare_print_button() {
|
||||
static Fl_Window w(0,0,140,60);
|
||||
static Fl_Button bp(0,0,w.w(),30, "Print front window");
|
||||
bp.callback(printFront);
|
||||
@ -2999,7 +2985,11 @@ void preparePrintFront(void)
|
||||
bc.callback(copyFront);
|
||||
w.end();
|
||||
w.show();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int unused = prepare_print_button();
|
||||
|
||||
#endif // USE_PRINT_BUTTON
|
||||
|
||||
#endif
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
virtual void draw_end();
|
||||
virtual void make_current();
|
||||
virtual void label(const char *name, const char *mininame);
|
||||
virtual void show();
|
||||
|
||||
virtual void shape(const Fl_Image* img);
|
||||
// that one is implemented in Fl_Cocoa.mm because it uses Objective-c
|
||||
|
@ -79,6 +79,7 @@ public:
|
||||
virtual void flush_overlay();
|
||||
virtual void draw_begin();
|
||||
virtual void make_current();
|
||||
virtual void show();
|
||||
virtual void label(const char *name,const char *iname);
|
||||
|
||||
virtual void shape(const Fl_Image* img);
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
virtual void flush_overlay();
|
||||
virtual void draw_begin();
|
||||
virtual void make_current();
|
||||
virtual void show();
|
||||
virtual void show_menu();
|
||||
virtual void label(const char *name, const char *mininame);
|
||||
virtual void destroy_double_buffer();
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
#include <FL/Fl_Overlay_Window.H>
|
||||
#include <FL/Fl_Menu_Window.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/fl_ask.H>
|
||||
#include <FL/Fl.H>
|
||||
@ -32,6 +33,13 @@
|
||||
#define ShapeBounding 0
|
||||
#define ShapeSet 0
|
||||
|
||||
#if HAVE_OVERLAY
|
||||
extern XVisualInfo *fl_find_overlay_visual();
|
||||
extern XVisualInfo *fl_overlay_visual;
|
||||
extern Colormap fl_overlay_colormap;
|
||||
extern unsigned long fl_transparent_pixel;
|
||||
#endif
|
||||
|
||||
Window fl_window;
|
||||
|
||||
|
||||
@ -440,6 +448,19 @@ void Fl_X11_Window_Driver::make_current() {
|
||||
}
|
||||
|
||||
|
||||
void Fl_X11_Window_Driver::show_menu()
|
||||
{
|
||||
#if HAVE_OVERLAY
|
||||
if (!pWindow->shown() && ((Fl_Menu_Window*)pWindow)->overlay() && fl_find_overlay_visual()) {
|
||||
XInstallColormap(fl_display, fl_overlay_colormap);
|
||||
fl_background_pixel = int(fl_transparent_pixel);
|
||||
Fl_X::make_xid(pWindow, fl_overlay_visual, fl_overlay_colormap);
|
||||
fl_background_pixel = -1;
|
||||
} else
|
||||
#endif
|
||||
pWindow->Fl_Window::show();
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user