1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
|
//
// Group Node header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2023 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
#ifndef FLUID_NODES_GROUP_NODE_H
#define FLUID_NODES_GROUP_NODE_H
#include "nodes/Widget_Node.h"
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Pack.H>
#include <FL/Fl_Flex.H>
#include <FL/Fl_Wizard.H>
void group_cb(Fl_Widget *, void *);
void ungroup_cb(Fl_Widget *, void *);
// ---- Group_Node -------------------------------------------------- MARK: -
/**
Proxy group to use in place of Fl_Group in the interactive window.
In an interactive environment, groups should not automatically resize their
children. This proxy disables the layout of children by default. Children
layout propagation may be enable temporarily by incrementing `allow_layout`
before resizing and decrementing it again afterwards.
*/
class Fl_Group_Proxy : public Fl_Group {
public:
Fl_Group_Proxy(int X,int Y,int W,int H) : Fl_Group(X, Y, W, H) { Fl_Group::current(0); }
void resize(int x, int y, int w, int h);
void draw();
};
class Group_Node : public Widget_Node
{
public:
typedef Widget_Node super;
static Group_Node prototype;
public:
void ideal_size(int &w, int &h);
const char *type_name() {return "Fl_Group";}
const char *alt_type_name() {return "fltk::Group";}
Fl_Widget *widget(int X,int Y,int W,int H) {
Fl_Group_Proxy *g = new Fl_Group_Proxy(X,Y,W,H); Fl_Group::current(0); return g;}
Widget_Node *_make() {return new Group_Node();}
void write_code1(Code_Writer& f);
void write_code2(Code_Writer& f);
void add_child(Node*, Node*);
void move_child(Node*, Node*);
void remove_child(Node*);
int can_have_children() const {return 1;}
Type type() const { return FLD_NODE_TYPE_Group; }
bool is_a(Type inType) const { return (inType==FLD_NODE_TYPE_Group) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0);
void leave_live_mode();
void copy_properties();
};
// ---- Pack_Node --------------------------------------------------- MARK: -
extern const char pack_type_name[];
extern Fl_Menu_Item pack_type_menu[];
class Pack_Node : public Group_Node
{
public:
typedef Group_Node super;
static Pack_Node prototype;
private:
Fl_Menu_Item *subtypes() {return pack_type_menu;}
public:
const char *type_name() {return pack_type_name;}
const char *alt_type_name() {return "fltk::PackedGroup";}
Widget_Node *_make() {return new Pack_Node();}
Type type() const { return FLD_NODE_TYPE_Pack; }
bool is_a(Type inType) const { return (inType==FLD_NODE_TYPE_Pack) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0);
void copy_properties();
};
// ---- Flex_Node --------------------------------------------------- MARK: -
extern const char flex_type_name[];
extern Fl_Menu_Item flex_type_menu[];
class Fl_Flex_Proxy : public Fl_Flex {
public:
Fl_Flex_Proxy(int X,int Y,int W,int H) : Fl_Flex(X, Y, W, H) { Fl_Group::current(0); }
void resize(int x, int y, int w, int h);
void draw();
};
class Flex_Node : public Group_Node
{
public:
typedef Group_Node super;
static Flex_Node prototype;
private:
Fl_Menu_Item *subtypes() {return flex_type_menu;}
int fixedSizeTupleSize; /* number of pairs in array */
int *fixedSizeTuple; /* [ index, size, index2, size2, ... ] */
int suspend_auto_layout;
public:
Flex_Node() : fixedSizeTupleSize(0), fixedSizeTuple(0), suspend_auto_layout(0) { }
const char *type_name() {return flex_type_name;}
const char *alt_type_name() {return "fltk::FlexGroup";}
Widget_Node *_make() { return new Flex_Node(); }
Fl_Widget *widget(int X,int Y,int W,int H) {
Fl_Flex *g = new Fl_Flex_Proxy(X,Y,W,H); Fl_Group::current(0); return g;}
Type type() const { return FLD_NODE_TYPE_Flex; }
bool is_a(Type inType) const { return (inType==FLD_NODE_TYPE_Flex) ? true : super::is_a(inType); }
void write_properties(Project_Writer &f);
void read_property(Project_Reader &f, const char *);
Fl_Widget *enter_live_mode(int top=0);
void copy_properties();
void copy_properties_for_children();
void postprocess_read();
void write_code2(Code_Writer& f);
// void add_child(Node*, Node*);
// void move_child(Node*, Node*);
void remove_child(Node*);
void layout_widget();
void change_subtype_to(int n);
void insert_child_at(Fl_Widget *child, int x, int y);
void keyboard_move_child(Widget_Node*, int key);
static int parent_is_flex(Node*);
static int size(Node*, char fixed_only=0);
static int is_fixed(Node*);
};
// ---- Table_Node -------------------------------------------------- MARK: -
class Table_Node : public Group_Node
{
public:
typedef Group_Node super;
static Table_Node prototype;
public:
void ideal_size(int &w, int &h);
const char *type_name() { return "Fl_Table"; }
const char *alt_type_name() { return "fltk::TableGroup"; }
Widget_Node *_make() { return new Table_Node(); }
Fl_Widget *widget(int X, int Y, int W, int H);
Type type() const { return FLD_NODE_TYPE_Table; }
bool is_a(Type inType) const { return (inType==FLD_NODE_TYPE_Table) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0);
void add_child(Node*, Node*);
void move_child(Node*, Node*);
void remove_child(Node*);
};
// ---- Tabs_Node --------------------------------------------------- MARK: -
extern const char tabs_type_name[];
class Fl_Tabs_Proxy : public Fl_Tabs {
public:
Fl_Tabs_Proxy(int X,int Y,int W,int H) : Fl_Tabs(X,Y,W,H) {}
void resize(int,int,int,int);
void draw();
};
class Tabs_Node : public Group_Node
{
public:
typedef Group_Node super;
static Tabs_Node prototype;
public:
const char *type_name() {return tabs_type_name;}
const char *alt_type_name() {return "fltk::TabGroup";}
Fl_Widget *widget(int X,int Y,int W,int H) {
Fl_Tabs_Proxy *g = new Fl_Tabs_Proxy(X,Y,W,H); Fl_Group::current(0); return g;}
Widget_Node *_make() {return new Tabs_Node();}
Node* click_test(int,int);
void add_child(Node*, Node*);
void remove_child(Node*);
Type type() const { return FLD_NODE_TYPE_Tabs; }
bool is_a(Type inType) const { return (inType==FLD_NODE_TYPE_Tabs) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0);
};
// ---- Scroll_Node ------------------------------------------------- MARK: -
extern const char scroll_type_name[];
extern Fl_Menu_Item scroll_type_menu[];
class Scroll_Node : public Group_Node
{
public:
typedef Group_Node super;
static Scroll_Node prototype;
private:
Fl_Menu_Item *subtypes() {return scroll_type_menu;}
public:
const char *type_name() {return scroll_type_name;}
const char *alt_type_name() {return "fltk::ScrollGroup";}
Widget_Node *_make() {return new Scroll_Node();}
Type type() const { return FLD_NODE_TYPE_Scroll; }
bool is_a(Type inType) const { return (inType==FLD_NODE_TYPE_Scroll) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0);
void copy_properties();
};
// ---- Tile_Node --------------------------------------------------- MARK: -
extern const char tile_type_name[];
class Tile_Node : public Group_Node
{
public:
typedef Group_Node super;
static Tile_Node prototype;
public:
const char *type_name() {return tile_type_name;}
const char *alt_type_name() {return "fltk::TileGroup";}
Widget_Node *_make() {return new Tile_Node();}
Type type() const { return FLD_NODE_TYPE_Tile; }
bool is_a(Type inType) const { return (inType==FLD_NODE_TYPE_Tile) ? true : super::is_a(inType); }
Fl_Widget *enter_live_mode(int top=0);
void leave_live_mode();
void copy_properties();
};
// ---- Wizard_Node ------------------------------------------------- MARK: -
class Fl_Wizard_Proxy : public Fl_Wizard {
public:
Fl_Wizard_Proxy(int X,int Y,int W,int H) : Fl_Wizard(X,Y,W,H) {}
void resize(int,int,int,int);
void draw();
};
extern const char wizard_type_name[];
class Wizard_Node : public Group_Node
{
public:
typedef Group_Node super;
static Wizard_Node prototype;
public:
const char *type_name() {return wizard_type_name;}
const char *alt_type_name() {return "fltk::WizardGroup";}
Fl_Widget *widget(int X,int Y,int W,int H) {
Fl_Wizard_Proxy *g = new Fl_Wizard_Proxy(X,Y,W,H); Fl_Group::current(0); return g;}
Widget_Node *_make() {return new Wizard_Node();}
Type type() const { return FLD_NODE_TYPE_Wizard; }
bool is_a(Type inType) const { return (inType==FLD_NODE_TYPE_Wizard) ? true : super::is_a(inType); }
};
#endif // FLUID_NODES_GROUP_NODE_H
|