diff options
Diffstat (limited to 'editor/connections_dialog.h')
-rw-r--r-- | editor/connections_dialog.h | 85 |
1 files changed, 61 insertions, 24 deletions
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 5e26e00f67..932ff693e4 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -28,6 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +/** +@author Juan Linietsky <reduzio@gmail.com> +*/ + #ifndef CONNECTIONS_DIALOG_H #define CONNECTIONS_DIALOG_H @@ -42,27 +46,28 @@ #include "scene/gui/tree.h" #include "undo_redo.h" -/** -@author Juan Linietsky <reduzio@gmail.com> -*/ - +class PopupMenu; class ConnectDialogBinds; class ConnectDialog : public ConfirmationDialog { GDCLASS(ConnectDialog, ConfirmationDialog); - ConfirmationDialog *error; + Node *source; + StringName signal; LineEdit *dst_path; LineEdit *dst_method; + ConnectDialogBinds *cdbinds; + bool bEditMode; + SceneTreeEditor *tree; + ConfirmationDialog *error; + PropertyEditor *bind_editor; OptionButton *type_list; CheckButton *deferred; CheckButton *oneshot; CheckButton *make_callback; - PropertyEditor *bind_editor; - Node *node; - ConnectDialogBinds *cdbinds; + void ok_pressed(); void _cancel_pressed(); void _tree_node_selected(); @@ -74,37 +79,71 @@ protected: static void _bind_methods(); public: - bool get_make_callback() { return make_callback->is_visible() && make_callback->is_pressed(); } + Node *get_source() const; + StringName get_signal_name() const; NodePath get_dst_path() const; - StringName get_dst_method() const; + void set_dst_node(Node *p_node); + StringName get_dst_method_name() const; + void set_dst_method(const StringName &p_method); + Vector<Variant> get_binds() const; + + bool get_make_callback() { return make_callback->is_visible() && make_callback->is_pressed(); } bool get_deferred() const; bool get_oneshot() const; - Vector<Variant> get_binds() const; - void set_dst_method(const StringName &p_method); - void set_dst_node(Node *p_node); + bool is_editing() const; - void edit(Node *p_node); + void init(Connection c, bool bEdit = false); ConnectDialog(); ~ConnectDialog(); }; +//======================================== + class ConnectionsDock : public VBoxContainer { GDCLASS(ConnectionsDock, VBoxContainer); - Button *connect_button; - EditorNode *editor; - Node *node; + //Right-click Pop-up Menu Options. + enum SignalMenuOption { + CONNECT, + DISCONNECT_ALL + }; + + enum SlotMenuOption { + EDIT, + GO_TO_SCRIPT, + DISCONNECT + }; + + Node *selectedNode; Tree *tree; - ConfirmationDialog *remove_confirm; + EditorNode *editor; + + ConfirmationDialog *disconnect_all_dialog; ConnectDialog *connect_dialog; + Button *connect_button; + PopupMenu *signal_menu; + PopupMenu *slot_menu; + UndoRedo *undo_redo; + + void _make_or_edit_connection(); + void _connect(Connection cToMake); + void _disconnect(TreeItem &item); + void _disconnect_all(); + void _tree_item_selected(); + void _tree_item_activated(); + bool _is_item_signal(TreeItem &item); + + void _open_connection_dialog(TreeItem &item); + void _open_connection_dialog(Connection cToEdit); + void _go_to_script(TreeItem &item); + + void _handle_signal_menu_option(int option); + void _handle_slot_menu_option(int option); + void _rmb_pressed(Vector2 position); void _close(); - void _connect(); - void _something_selected(); - void _something_activated(); - UndoRedo *undo_redo; protected: void _connect_pressed(); @@ -113,9 +152,7 @@ protected: public: void set_undoredo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; } - void set_node(Node *p_node); - String get_selected_type(); void update_tree(); ConnectionsDock(EditorNode *p_editor = NULL); |