diff options
| author | Matthias Melcher <github@matthiasm.com> | 2024-12-27 20:56:02 -0500 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2024-12-27 20:56:10 -0500 |
| commit | 050cbabdfe2fdbd1337736f017456012e2437b2d (patch) | |
| tree | 21efed95ef5368e67a7a6377ab0a3a2f936e4426 /fluid/Fl_Type.h | |
| parent | 2100655a1b55d1c77932b649b758f2eab1107fcb (diff) | |
Fluid: Rename Stratgy constants to comply with CMP.
Capitalized constants.
Added flag to indicate creation by user or file.
Removed global variable 'reading_file'.
Diffstat (limited to 'fluid/Fl_Type.h')
| -rw-r--r-- | fluid/Fl_Type.h | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h index f38508e16..50f4b34b1 100644 --- a/fluid/Fl_Type.h +++ b/fluid/Fl_Type.h @@ -30,9 +30,14 @@ class Fd_Project_Reader; class Fd_Project_Writer; /** - Declare where a new type is placed in the hierarchy. + Declare where a new type is placed and how to create it. - Note that a type can also be the start of a hierarchy of types. In that case, + Placement can be as the first or last child of the anchor, or right after the + anchor. In most cases, the anchor is the last selected type node. + + If the source is FROM_USER, widgets may be created with default titles and + labels. Type created FROM_FILE will start with no label, so the label is set + correctly later. \see Fl_Type *Fl_..._Type::make(Strategy strategy) calls `add()` Add single Type: @@ -45,10 +50,25 @@ class Fd_Project_Writer; Fl_Type *Fd_Project_Reader::read_children(Fl_Type *p, int merge, Strategy strategy, char skip_options) int Fd_Project_Reader::read_project(const char *filename, int merge, Strategy strategy) */ -typedef enum { - kAddAsFirstChild = 0, - kAddAsLastChild, - kAddAfterCurrent +typedef struct Strategy { + enum Flags { + AS_FIRST_CHILD = 0x0000, + AS_LAST_CHILD = 0x0001, + AFTER_CURRENT = 0x0002, + PLACEMENT_MASK = 0x000f, + FROM_USER = 0x0000, + FROM_FILE = 0x0010, + SOURCE_MASK = 0x00f0, + FROM_FILE_AS_FIRST_CHILD = 0x0010, + FROM_FILE_AS_LAST_CHILD = 0x0011, + FROM_FILE_AFTER_CURRENT = 0x0012, + }; + Flags flags; + Strategy(Flags f) { flags = f; } + void placement(Flags f) { flags = (Flags)((flags & ~PLACEMENT_MASK) | (f & PLACEMENT_MASK)); } + Flags placement() { return (Flags)(flags & PLACEMENT_MASK); } + void source(Flags f) { flags = (Flags)((flags & ~SOURCE_MASK) | (f & SOURCE_MASK)); } + Flags source() { return (Flags)(flags & SOURCE_MASK); } } Strategy; enum ID { |
