summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-09-28 16:21:31 +0200
committerMatthias Melcher <github@matthiasm.com>2023-09-29 14:12:39 +0200
commitf3eae58c520a37e93095356de88781df5b831eeb (patch)
treeae5527fcc6f93d667a51c972268034c5f2657f9c /src
parentff0a3a9d59ecc6acecdebfd44250746a786636b6 (diff)
Draw parent window backdrop on Fl_Tabs (#718)
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Tabs.cxx7
-rw-r--r--src/Fl_Window.cxx26
2 files changed, 21 insertions, 12 deletions
diff --git a/src/Fl_Tabs.cxx b/src/Fl_Tabs.cxx
index f84a0002f..1f5aaadd1 100644
--- a/src/Fl_Tabs.cxx
+++ b/src/Fl_Tabs.cxx
@@ -25,6 +25,7 @@
#include <FL/fl_draw.H>
#include <FL/Fl_Tooltip.H>
#include <FL/Fl_Menu_Item.H>
+#include <FL/Fl_Window.H>
#include <stdio.h>
#include <stdlib.h>
@@ -805,10 +806,12 @@ void Fl_Tabs::draw() {
if (parent()) {
Fl_Widget *p = parent();
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());
- else
+ win->draw_backdrop();
+ } else {
fl_draw_box(p->box(), p->x(), p->y(), p->w(), p->h(), p->color());
+ }
fl_pop_clip();
} else {
fl_rectf(x(), tabs_y, w(), tabs_h, color());
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index 551a61882..f2d527485 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -507,16 +507,7 @@ void Fl_Window::draw()
if (damage() & ~FL_DAMAGE_CHILD) { // draw the entire thing
draw_box(box(),0,0,w(),h(),color()); // draw box with x/y = 0
-
- 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_backdrop();
}
draw_children();
@@ -524,6 +515,21 @@ void Fl_Window::draw()
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()
{
pWindowDriver->make_current();