Improve theme-level background image support.
This commit is contained in:
parent
f5b3702be1
commit
2565fe25cd
2
FL/Fl.H
2
FL/Fl.H
|
@ -275,6 +275,8 @@ public:
|
|||
See void scheme(const char *name)
|
||||
*/
|
||||
static int reload_scheme(); // platform dependent
|
||||
|
||||
static void scheme_bg ( Fl_Image *i ) { scheme_bg_ = i; }
|
||||
static int scrollbar_size();
|
||||
static void scrollbar_size(int W);
|
||||
|
||||
|
|
|
@ -176,6 +176,9 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
|
|||
friend class Fl_Quartz_Graphics_Driver;
|
||||
friend class Fl_GDI_Graphics_Driver;
|
||||
friend class Fl_Xlib_Graphics_Driver;
|
||||
#if FLTK_HAVE_CAIRO
|
||||
friend class Fl_Cairo_Graphics_Driver;
|
||||
#endif
|
||||
public:
|
||||
|
||||
const uchar *array;
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
overlay will blink if you change the image in the window.
|
||||
*/
|
||||
class FL_EXPORT Fl_Overlay_Window : public Fl_Double_Window {
|
||||
protected:
|
||||
virtual void draw_overlay() = 0;
|
||||
public:
|
||||
void flush();
|
||||
|
|
|
@ -1703,14 +1703,6 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
|
|||
Fl::damage(FL_DAMAGE_CHILD);
|
||||
}
|
||||
void Fl_Window::flush() {
|
||||
|
||||
if ( ! i->cc )
|
||||
{
|
||||
i->cs = Fl::cairo_create_surface( i->xid, w(), h() );
|
||||
i->cc = cairo_create( i->cs );
|
||||
Fl::cairo_make_current( i->cs, i->cc );
|
||||
}
|
||||
|
||||
draw();
|
||||
|
||||
#if FLTK_HAVE_CAIRO
|
||||
|
|
|
@ -276,12 +276,6 @@ int Fl::scheme(const char *s) {
|
|||
int Fl::reload_scheme() {
|
||||
Fl_Window *win;
|
||||
|
||||
// Use the standard FLTK look-n-feel...
|
||||
if (scheme_bg_) {
|
||||
delete scheme_bg_;
|
||||
scheme_bg_ = (Fl_Image *)0;
|
||||
}
|
||||
|
||||
set_boxtype(FL_UP_FRAME, fl_up_frame, D1, D1, D2, D2);
|
||||
set_boxtype(FL_DOWN_FRAME, fl_down_frame, D1, D1, D2, D2);
|
||||
set_boxtype(FL_THIN_UP_FRAME, fl_thin_up_frame, 1, 1, 2, 2);
|
||||
|
@ -299,8 +293,9 @@ int Fl::reload_scheme() {
|
|||
|
||||
// Set (or clear) the background tile for all windows...
|
||||
for (win = first_window(); win; win = next_window(win)) {
|
||||
win->labeltype(scheme_bg_ ? FL_NORMAL_LABEL : FL_NO_LABEL);
|
||||
win->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
|
||||
// win->labeltype(scheme_bg_ ? FL_NORMAL_LABEL : FL_NO_LABEL);
|
||||
// win->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP | FL_ALIGN_IMAGE_BACKDROP );
|
||||
win->align( FL_ALIGN_IMAGE_BACKDROP );
|
||||
win->image(scheme_bg_);
|
||||
win->redraw();
|
||||
}
|
||||
|
|
16
src/Fl_x.cxx
16
src/Fl_x.cxx
|
@ -1691,6 +1691,7 @@ Fl_X* Fl_X::set_xid(Fl_Window* win, Window winxid) {
|
|||
xp->setwindow(win);
|
||||
xp->next = Fl_X::first;
|
||||
xp->region = 0;
|
||||
xp->wait_for_expose = 0;
|
||||
// xp->backbuffer_bad = 1;
|
||||
Fl_X::first = xp;
|
||||
if (win->modal()) {Fl::modal_ = win; fl_fix_focus();}
|
||||
|
@ -2007,21 +2008,20 @@ 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);
|
||||
// labeltype(FL_NORMAL_LABEL);
|
||||
align(FL_ALIGN_IMAGE_BACKDROP);
|
||||
} else {
|
||||
labeltype(FL_NO_LABEL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Fl_Tooltip::exit(this);
|
||||
if (!shown()) {
|
||||
fl_open_display();
|
||||
// Don't set background pixel for double-buffered windows...
|
||||
if (type() == FL_WINDOW && can_boxcheat(box())) {
|
||||
fl_background_pixel = int(fl_xpixel(color()));
|
||||
}
|
||||
|
||||
/* // Don't set background pixel for double-buffered windows... */
|
||||
/* if (type() == FL_WINDOW && can_boxcheat(box())) { */
|
||||
/* fl_background_pixel = int(fl_xpixel(color())); */
|
||||
/* } */
|
||||
|
||||
Fl_X::make_xid(this);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue