summaryrefslogtreecommitdiff
path: root/fluid/Fl_Group_Type.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-11-01 17:22:31 +0100
committerMatthias Melcher <github@matthiasm.com>2023-11-01 17:22:40 +0100
commitaaaf0a0537e03cec7a47330550a31bb4e96dacde (patch)
tree820ea79b85ed1e3b9fdcfe9ef0b2fc16a15c5cc6 /fluid/Fl_Group_Type.cxx
parent5f836377a0f4e5c7b90b06ba4b4fefc3ccf04a39 (diff)
FLUID: Adds options to draw ghosted outlines.
Diffstat (limited to 'fluid/Fl_Group_Type.cxx')
-rw-r--r--fluid/Fl_Group_Type.cxx81
1 files changed, 80 insertions, 1 deletions
diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx
index c66e4daab..10c3fc438 100644
--- a/fluid/Fl_Group_Type.cxx
+++ b/fluid/Fl_Group_Type.cxx
@@ -44,7 +44,6 @@ Fl_Group_Type Fl_Group_type; // the "factory"
/**
Override group's resize behavior to do nothing to children by default.
-
\param[in] X, Y, W, H new size
*/
void Fl_Group_Proxy::resize(int X, int Y, int W, int H) {
@@ -57,6 +56,28 @@ void Fl_Group_Proxy::resize(int X, int Y, int W, int H) {
}
/**
+ Override draw() to make groups with no box or flat box background visible.
+ */
+void Fl_Group_Proxy::draw() {
+ if (show_ghosted_outline) {
+ // it would be nice to check if the parent is Fl_Tabs, because the parent
+ // would then draw the outline... .
+ if (!box()) {
+ fl_rect(x(), y(), w(), h(), Fl::box_color(fl_color_average(FL_FOREGROUND_COLOR, color(), .1f)));
+ Fl_Group::draw();
+ } else if (box() == FL_FLAT_BOX && parent() && parent()->color() == color()) {
+ Fl_Group::draw();
+ fl_rect(x(), y(), w(), h(), Fl::box_color(fl_color_average(FL_FOREGROUND_COLOR, color(), .1f)));
+ } else {
+ Fl_Group::draw();
+ }
+ } else {
+ Fl_Group::draw();
+ }
+}
+
+
+/**
\brief Enlarge the group size, so all children fit within.
*/
void fix_group_size(Fl_Type *tt) {
@@ -252,6 +273,25 @@ void Fl_Flex_Proxy::resize(int X, int Y, int W, int H) {
redraw();
}
+/**
+ Override draw() to make groups with no box or flat box background visible.
+ */
+void Fl_Flex_Proxy::draw() {
+ if (show_ghosted_outline) {
+ if (!box()) {
+ fl_rect(x(), y(), w(), h(), Fl::box_color(fl_color_average(FL_FOREGROUND_COLOR, color(), .1f)));
+ Fl_Flex::draw();
+ } else if (box() == FL_FLAT_BOX && parent() && parent()->color() == color()) {
+ Fl_Flex::draw();
+ fl_rect(x(), y(), w(), h(), Fl::box_color(fl_color_average(FL_FOREGROUND_COLOR, color(), .1f)));
+ } else {
+ Fl_Flex::draw();
+ }
+ } else {
+ Fl_Flex::draw();
+ }
+}
+
Fl_Widget *Fl_Flex_Type::enter_live_mode(int) {
Fl_Flex *grp = new Fl_Flex(o->x(), o->y(), o->w(), o->h());
propagate_live_mode(grp);
@@ -598,6 +638,25 @@ void Fl_Tabs_Proxy::resize(int X, int Y, int W, int H) {
redraw();
}
+/**
+ Override draw() to make groups with no box or flat box background visible.
+ */
+void Fl_Tabs_Proxy::draw() {
+ if (show_ghosted_outline) {
+ if (!box()) {
+ fl_rect(x(), y(), w(), h(), Fl::box_color(fl_color_average(FL_FOREGROUND_COLOR, color(), .1f)));
+ Fl_Tabs::draw();
+ } else if (box() == FL_FLAT_BOX && parent() && parent()->color() == color()) {
+ Fl_Tabs::draw();
+ fl_rect(x(), y(), w(), h(), Fl::box_color(fl_color_average(FL_FOREGROUND_COLOR, color(), .1f)));
+ } else {
+ Fl_Tabs::draw();
+ }
+ } else {
+ Fl_Tabs::draw();
+ }
+}
+
// This is called when user clicks on a widget in the window. See
// if it is a tab title, and adjust visibility and return new selection:
// If none, return o unchanged:
@@ -691,3 +750,23 @@ void Fl_Wizard_Proxy::resize(int X, int Y, int W, int H) {
}
redraw();
}
+
+/**
+ Override draw() to make groups with no box or flat box background visible.
+ */
+void Fl_Wizard_Proxy::draw() {
+ if (show_ghosted_outline) {
+ if (!box()) {
+ fl_rect(x(), y(), w(), h(), Fl::box_color(fl_color_average(FL_FOREGROUND_COLOR, color(), .1f)));
+ Fl_Wizard::draw();
+ } else if (box() == FL_FLAT_BOX && parent() && parent()->color() == color()) {
+ Fl_Wizard::draw();
+ fl_rect(x(), y(), w(), h(), Fl::box_color(fl_color_average(FL_FOREGROUND_COLOR, color(), .1f)));
+ } else {
+ Fl_Wizard::draw();
+ }
+ } else {
+ Fl_Wizard::draw();
+ }
+}
+