MySQL Workbench  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
task_sidebar.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; version 2 of the
7  * License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17  * 02110-1301 USA
18  */
19 #ifndef _MFORMS_TASK_SIDEBAR_H_
20 #define _MFORMS_TASK_SIDEBAR_H_
21 
25 #include <mforms/box.h>
26 #include <mforms/app.h>
27 
28 #include <vector>
29 
30 #ifndef DOXYGEN_SHOULD_SKIP_THIS
31 
32 namespace wb {
33  class LiveSchemaTree; // The tree model for the schema treeview.
34 };
35 
36 namespace mforms {
37 
38  class ContextMenu;
39  class TreeNodeView;
40  class TaskSidebar;
41  class TextEntry;
42 
43  enum TaskSectionFlags
44  {
45  TaskSectionPlain = 0,
46  TaskSectionRefreshable = 1,
47  TaskSectionCollapsible = 2,
48  TaskSectionToggleModeButton = 4,
49  TaskSectionToggleModeButtonPreSelected = 8,
50  TaskSectionShowConfigButton = 0x10,
51  };
52 
53  inline TaskSectionFlags operator | (TaskSectionFlags a, TaskSectionFlags b)
54  {
55  return (TaskSectionFlags)((int)a|(int)b);
56  }
57 
58  enum TaskEntryType
59  {
60  TaskEntrySelectableItem,
61  TaskEntryLink,
62  TaskEntryPlainItem
63  };
64 
65  class MFORMS_EXPORT TaskSidebar : public Box
66  {
67  private:
68  boost::signals2::signal<void (const std::string&)> _on_section_command;
69 
70  protected:
71  TaskSidebar();
72 
73  public:
74  static TaskSidebar* create(const std::string &type); // Create an instance from the factory
75 
76  public:
77  virtual int add_section(const std::string& name, const std::string &title, TaskSectionFlags flags = TaskSectionPlain) = 0;
78  virtual void remove_section(const std::string& name) = 0;
79  virtual int add_section_entry(const std::string& section_name, const std::string &entry_name, const std::string& title,
80  const std::string& icon, TaskEntryType type) = 0;
81  virtual void set_section_entry_text(const std::string& entry_name, const std::string& title) = 0;
82  virtual void set_section_entry_icon(const std::string& entry_name, const std::string& icon) = 0;
83  virtual void set_section_entry_enabled(const std::string& entry_name, bool flag) = 0;
84  virtual void mark_section_busy(const std::string& section_name, bool busy) = 0;
85  virtual void remove_section_entry(const std::string& entry_name) = 0;
86 
87  virtual void set_collapse_states(const std::string& data)= 0;
88  virtual std::string get_collapse_states()= 0;
89 
90  virtual void clear_sections() = 0;
91  virtual void clear_section(const std::string& section_name) = 0;
92  virtual void set_selection_color (const std::string& color) = 0;
93  virtual void set_selection_color (const mforms::SystemColor color) = 0;
94 
95  virtual int select_entry(const std::string& entry_name) = 0;
96  virtual std::string selected_entry() = 0;
97  virtual void clear_selection() = 0;
98 
99  boost::signals2::signal<void (const std::string&)>* on_section_command() { return &_on_section_command;};
100 
101  public: // Only for advanced sidebar
102  virtual void set_schema_model(wb::LiveSchemaTree* model) {}
103  virtual void set_filtered_schema_model(wb::LiveSchemaTree* model) {}
104  virtual void enable_server_search(bool enabled) {}
105 
106  virtual TreeNodeView *get_schema_tree() { return NULL; }
107  virtual TextEntry *get_filter_entry() { return NULL; }
108 
109  virtual void expand_schema(int schema_index) {}
110 
111  virtual boost::signals2::signal<void (const std::string&)>* signal_filter_changed() { return NULL; }
112  virtual boost::signals2::signal<void (void)>* tree_node_selected() { return NULL; }
113 
114  virtual mforms::ContextMenu *get_context_menu() { return NULL; }
115 
116 #ifndef SWIG
117  static void register_factory(const std::string &type, TaskSidebar* (*create)());
118 #endif
119  private:
120  };
121 }
122 
123 #endif // !DOXYGEN_SHOULD_SKIP_THIS
124 #endif // _MFORMS_TASK_SIDEBAR_H_
SystemColor
Definition: app.h:32
LineMarkup operator|(LineMarkup a, LineMarkup b)
Definition: code_editor.h:73
#define MFORMS_EXPORT
Definition: base.h:33
A menu that can be attached to other controls.
Definition: menubar.h:177
MySQL Workbench 6.1 documentation