summaryrefslogtreecommitdiff
path: root/fluid/Fl_Type.h
diff options
context:
space:
mode:
authorMatthias Melcher <git@matthiasm.com>2021-12-11 19:43:00 +0100
committerMatthias Melcher <github@matthiasm.com>2021-12-13 18:17:07 +0100
commit160832ce04f932fbb3df199aa01d1c93148bb292 (patch)
treed1ce303700666997a8608b7a488a25e633f07804 /fluid/Fl_Type.h
parenta802aaeb170e3c233c5d92ae29d8703a0b9c2768 (diff)
STR 3442: copy/paste now inserts widget as expected.
Fluid would add pasted widgets as the last child of the current group, even if they were cut at the beginning of the group. This patch adds a 'startegy' to adding widgets to allow merging closer to the 'current' widget. Also added d'n'd for the widget bin and some other UI improvements. STR 3442: some preparation, variable renaming STR 3442: unifying functions to add widgets. Adding widgets interactively is merged into one function, making undo/redo work as expected and removing unexpected differences between adding by menu or bin. STR 3442: adding drag'n'drop for windows from bin. Just drag the window symbol out of the tree and drop it anywhere on the desktop. Visual representation of dragged Window. STR 3442: insert individual nodes after 'current' STR 3442: adding new widget at expected positions. The widget bin can finally do drag'n'drop. Widgets appear in the tree close to the last selection. Duplicating now ads right below. Cut and paste inserts after last selection. Fluid: replaced #define with strict enum type.
Diffstat (limited to 'fluid/Fl_Type.h')
-rw-r--r--fluid/Fl_Type.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index 9027b4fc5..fa3a81ce9 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -21,6 +21,13 @@
#include <FL/fl_draw.H>
class Fl_Type;
+class Fl_Group_Type;
+class Fl_Window_Type;
+
+typedef enum {
+ kAddAsLastChild = 0,
+ kAddAfterCurrent
+} Strategy;
void fixvisible(Fl_Type *p);
void delete_all(int selected_only=0);
@@ -52,15 +59,15 @@ protected:
public: // things that should not be public:
- Fl_Type *parent; // parent, which is previous in list
+ Fl_Type *parent;
char new_selected; // browser highlight
char selected; // copied here by selection_changed()
char open_; // state of triangle in browser
char visible; // true if all parents are open
char rtti; // hack because I have no rtti, this is 0 for base class
int level; // number of parents over this
- static Fl_Type *first, *last; // linked list of all objects
- Fl_Type *next, *prev; // linked list of all objects
+ static Fl_Type *first, *last;
+ Fl_Type *next, *prev;
Fl_Type *factory;
const char *callback_name();
@@ -74,9 +81,12 @@ protected:
public:
virtual ~Fl_Type();
- virtual Fl_Type *make() = 0;
+ virtual Fl_Type *make(Strategy strategy) = 0;
+
+ Fl_Window_Type *window();
+ Fl_Group_Type *group();
- void add(Fl_Type *parent); // add as new child
+ void add(Fl_Type *parent, Strategy strategy);
void insert(Fl_Type *n); // insert into list before n
Fl_Type* remove(); // remove from list
void move_before(Fl_Type*); // move before a sibling
@@ -104,6 +114,8 @@ public:
virtual void remove_child(Fl_Type*) { }
static Fl_Type *current; // most recently picked object
+ static Fl_Type *current_dnd;
+
virtual void open(); // what happens when you double-click
// read and write data to a saved file: