Draw parent window backdrop on Fl_Tabs (#718)
This commit is contained in:
parent
ff0a3a9d59
commit
f3eae58c52
@ -587,8 +587,9 @@ public:
|
|||||||
virtual class Fl_Double_Window *as_double_window() {return 0L;}
|
virtual class Fl_Double_Window *as_double_window() {return 0L;}
|
||||||
|
|
||||||
void shape(const Fl_Image* img);
|
void shape(const Fl_Image* img);
|
||||||
void shape(const Fl_Image& b) ;
|
void shape(const Fl_Image& b);
|
||||||
const Fl_Image *shape();
|
const Fl_Image *shape();
|
||||||
|
void draw_backdrop();
|
||||||
int screen_num();
|
int screen_num();
|
||||||
void screen_num(int screen_num);
|
void screen_num(int screen_num);
|
||||||
static bool is_a_rescale();
|
static bool is_a_rescale();
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
#include <FL/Fl_Tooltip.H>
|
#include <FL/Fl_Tooltip.H>
|
||||||
#include <FL/Fl_Menu_Item.H>
|
#include <FL/Fl_Menu_Item.H>
|
||||||
|
#include <FL/Fl_Window.H>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -805,10 +806,12 @@ void Fl_Tabs::draw() {
|
|||||||
if (parent()) {
|
if (parent()) {
|
||||||
Fl_Widget *p = parent();
|
Fl_Widget *p = parent();
|
||||||
fl_push_clip(x(), tabs_y, w(), tabs_h);
|
fl_push_clip(x(), tabs_y, w(), tabs_h);
|
||||||
if (p->as_window())
|
if (Fl_Window *win = p->as_window()) {
|
||||||
fl_draw_box(p->box(), 0, 0, p->w(), p->h(), p->color());
|
fl_draw_box(p->box(), 0, 0, p->w(), p->h(), p->color());
|
||||||
else
|
win->draw_backdrop();
|
||||||
|
} else {
|
||||||
fl_draw_box(p->box(), p->x(), p->y(), p->w(), p->h(), p->color());
|
fl_draw_box(p->box(), p->x(), p->y(), p->w(), p->h(), p->color());
|
||||||
|
}
|
||||||
fl_pop_clip();
|
fl_pop_clip();
|
||||||
} else {
|
} else {
|
||||||
fl_rectf(x(), tabs_y, w(), tabs_h, color());
|
fl_rectf(x(), tabs_y, w(), tabs_h, color());
|
||||||
|
|||||||
@ -507,16 +507,7 @@ void Fl_Window::draw()
|
|||||||
|
|
||||||
if (damage() & ~FL_DAMAGE_CHILD) { // draw the entire thing
|
if (damage() & ~FL_DAMAGE_CHILD) { // draw the entire thing
|
||||||
draw_box(box(),0,0,w(),h(),color()); // draw box with x/y = 0
|
draw_box(box(),0,0,w(),h(),color()); // draw box with x/y = 0
|
||||||
|
draw_backdrop();
|
||||||
if (image() && (align() & FL_ALIGN_INSIDE)) { // draw the image only
|
|
||||||
Fl_Label l1;
|
|
||||||
memset(&l1,0,sizeof(l1));
|
|
||||||
l1.align_ = align();
|
|
||||||
l1.image = image();
|
|
||||||
if (!active_r() && l1.image && l1.deimage) l1.image = l1.deimage;
|
|
||||||
l1.type = labeltype();
|
|
||||||
l1.draw(0,0,w(),h(),align());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
draw_children();
|
draw_children();
|
||||||
|
|
||||||
@ -524,6 +515,21 @@ void Fl_Window::draw()
|
|||||||
if (!to_display) current_ = save_current;
|
if (!to_display) current_ = save_current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Draw the background image if one is set and is aligned inside.
|
||||||
|
*/
|
||||||
|
void Fl_Window::draw_backdrop() {
|
||||||
|
if (image() && (align() & FL_ALIGN_INSIDE)) { // draw the image only
|
||||||
|
Fl_Label l1;
|
||||||
|
memset(&l1,0,sizeof(l1));
|
||||||
|
l1.align_ = align();
|
||||||
|
l1.image = image();
|
||||||
|
if (!active_r() && l1.image && l1.deimage) l1.image = l1.deimage;
|
||||||
|
l1.type = labeltype();
|
||||||
|
l1.draw(0,0,w(),h(),align());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Fl_Window::make_current()
|
void Fl_Window::make_current()
|
||||||
{
|
{
|
||||||
pWindowDriver->make_current();
|
pWindowDriver->make_current();
|
||||||
|
|||||||
@ -315,16 +315,18 @@ public:
|
|||||||
o->labelcolor((Fl_Color)55);
|
o->labelcolor((Fl_Color)55);
|
||||||
o->tooltip("Fl_Adjuster with up box");
|
o->tooltip("Fl_Adjuster with up box");
|
||||||
} // Fl_Adjuster* o
|
} // Fl_Adjuster* o
|
||||||
{ Fl_Text_Editor* o = new Fl_Text_Editor(220, 53, 100, 29, "down frame");
|
{ Fl_Text_Editor* o = new Fl_Text_Editor(220, 40, 100, 25);
|
||||||
o->box(FL_DOWN_FRAME);
|
o->box(FL_DOWN_FRAME);
|
||||||
o->color((Fl_Color)19);
|
o->color((Fl_Color)19);
|
||||||
o->selection_color(FL_DARK1);
|
o->selection_color(FL_DARK1);
|
||||||
o->tooltip("Fl_Adjuster with down frame");
|
o->buffer(new Fl_Text_Buffer);
|
||||||
|
o->tooltip("Fl_Text_Editor with down frame");
|
||||||
} // Fl_Text_Editor* o
|
} // Fl_Text_Editor* o
|
||||||
{ Fl_Text_Editor* o = new Fl_Text_Editor(220, 99, 100, 38, "up frame");
|
{ Fl_Text_Editor* o = new Fl_Text_Editor(220, 70, 100, 25);
|
||||||
o->box(FL_UP_FRAME);
|
o->box(FL_UP_FRAME);
|
||||||
o->color((Fl_Color)19);
|
o->color((Fl_Color)19);
|
||||||
o->selection_color(FL_DARK1);
|
o->selection_color(FL_DARK1);
|
||||||
|
o->buffer(new Fl_Text_Buffer);
|
||||||
o->tooltip("Fl_Text_Editor with up frame");
|
o->tooltip("Fl_Text_Editor with up frame");
|
||||||
} // Fl_Text_Editor* o
|
} // Fl_Text_Editor* o
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user