summaryrefslogtreecommitdiff
path: root/fluid/factory.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2022-11-01 13:30:05 +0100
committerGitHub <noreply@github.com>2022-11-01 13:30:05 +0100
commit93ea93ee2b424ded25358d87529b1160cdb4f80c (patch)
treea0a445a21ac71c72e4983a5ed8bf854a70dec3a8 /fluid/factory.cxx
parent31ec6f623ab76d3f1107af9782237b8d7a089026 (diff)
Fluid support for Fl_Flex (#523) and some Fl_Flex improvements
* Adding Fluid support for Fl_Flex, margins, and gap. * Fluid Fl_Flex mostly working. Fixed in Fl_Flex::set_size(). * Fluid Flex live mode works, interactive dragging works * Fluid Flex: adding check box for fixed children * Fluid Flex: visual flexibility indicator in guides. * Fluid Flex: bug in generated code. * Fix formatting * Fixing Tooltip, fixing resize issue PR #518. * Removing unused variables. Co-authored-by: Albrecht Schlosser <albrechts.fltk@online.de>
Diffstat (limited to 'fluid/factory.cxx')
-rw-r--r--fluid/factory.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/fluid/factory.cxx b/fluid/factory.cxx
index d3888c654..4cfa2404c 100644
--- a/fluid/factory.cxx
+++ b/fluid/factory.cxx
@@ -26,6 +26,7 @@
#include "fluid.h"
#include "Fl_Window_Type.h"
+#include "Fl_Group_Type.h"
#include "pixmaps.h"
#include "undo.h"
@@ -35,6 +36,7 @@
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Tree.H>
+#include <FL/Fl_Flex.H>
#include "../src/flstring.h"
#include <stdio.h>
@@ -938,6 +940,7 @@ extern class Fl_Window_Type Fl_Window_type;
extern class Fl_Widget_Class_Type Fl_Widget_Class_type;
extern class Fl_Group_Type Fl_Group_type;
extern class Fl_Pack_Type Fl_Pack_type;
+extern class Fl_Flex_Type Fl_Flex_type;
extern class Fl_Tabs_Type Fl_Tabs_type;
extern class Fl_Scroll_Type Fl_Scroll_type;
extern class Fl_Table_Type Fl_Table_type;
@@ -976,6 +979,7 @@ static Fl_Type *known_types[] = {
(Fl_Type*)&Fl_Window_type,
(Fl_Type*)&Fl_Group_type,
(Fl_Type*)&Fl_Pack_type,
+ (Fl_Type*)&Fl_Flex_type,
(Fl_Type*)&Fl_Tabs_type,
(Fl_Type*)&Fl_Scroll_type,
(Fl_Type*)&Fl_Tile_type,
@@ -1055,7 +1059,8 @@ Fl_Type *add_new_widget_from_user(Fl_Type *inPrototype, Strategy strategy) {
undo_suspend();
Fl_Type *t = ((Fl_Type*)inPrototype)->make(strategy);
if (t) {
- if (t->is_widget() && !t->is_window()) {
+ if (t->is_widget() && !t->is_window())
+ {
Fl_Widget_Type *wt = (Fl_Widget_Type *)t;
// Set font sizes...
@@ -1071,7 +1076,9 @@ Fl_Type *add_new_widget_from_user(Fl_Type *inPrototype, Strategy strategy) {
int w = 0, h = 0;
wt->ideal_size(w, h);
- if (!strcmp(wt->type_name(), "Fl_Menu_Bar")) {
+ if ((t->parent && t->parent->is_flex())) {
+ // Do not resize or layout the widget. Flex will need the widget size.
+ } else if (!strcmp(wt->type_name(), "Fl_Menu_Bar")) {
// Move and resize the menubar across the top of the window...
wt->o->resize(0, 0, w, h);
} else {
@@ -1143,6 +1150,7 @@ Fl_Menu_Item New_Menu[] = {
{0,0,cb,(void*)&Fl_Window_type},
{0,0,cb,(void*)&Fl_Group_type},
{0,0,cb,(void*)&Fl_Pack_type},
+ {0,0,cb,(void*)&Fl_Flex_type},
{0,0,cb,(void*)&Fl_Tabs_type},
{0,0,cb,(void*)&Fl_Scroll_type},
{0,0,cb,(void*)&Fl_Tile_type},