File: task_sidebar.h

package info (click to toggle)
mysql-workbench 6.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 113,932 kB
  • ctags: 87,814
  • sloc: ansic: 955,521; cpp: 427,465; python: 59,728; yacc: 59,129; xml: 54,204; sql: 7,091; objc: 965; makefile: 638; sh: 613; java: 237; perl: 30; ruby: 6; php: 1
file content (126 lines) | stat: -rw-r--r-- 4,338 bytes parent folder | download | duplicates (2)
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
/* 
 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; version 2 of the
 * License.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#pragma once

/**
 * mforms interface to the advanced sidebar, which implements an iTunes like interface.
 */
#include <mforms/box.h>
#include <mforms/app.h>

#include <vector>

#ifndef DOXYGEN_SHOULD_SKIP_THIS

namespace wb {
  class LiveSchemaTree; // The tree model for the schema treeview.
};

namespace mforms {

  class ContextMenu;
  class TreeNodeView;
  class TaskSidebar;
  class TextEntry;

  enum TaskSectionFlags
  {
    TaskSectionPlain = 0,
    TaskSectionRefreshable = 1,
    TaskSectionCollapsible = 2,
    TaskSectionToggleModeButton = 4,
    TaskSectionToggleModeButtonPreSelected = 8,
    TaskSectionShowConfigButton = 0x10,
  };

#ifndef SWIG
  inline TaskSectionFlags operator | (TaskSectionFlags a, TaskSectionFlags b)
  {
    return (TaskSectionFlags)((int)a|(int)b);
  }
#endif

  enum TaskEntryType
  {
    TaskEntrySelectableItem,
    TaskEntryLink,
    TaskEntryAlwaysActiveLink, // same as TaskEntryLink, but will send action even if disabled
    TaskEntryPlainItem
  };

  class MFORMS_EXPORT TaskSidebar : public Box
  {
  private:
    boost::signals2::signal<void (const std::string&)> _on_section_command;

  protected:
    TaskSidebar();

  public:
    static TaskSidebar* create(const std::string &type); // Create an instance from the factory

  public:
    virtual int add_section(const std::string& name, const std::string &title, TaskSectionFlags flags = TaskSectionPlain) = 0;
    virtual void remove_section(const std::string& name) = 0;
    virtual int add_section_entry(const std::string& section_name, const std::string &entry_name, const std::string& title,
      const std::string& icon, TaskEntryType type) = 0;
    virtual void set_section_entry_text(const std::string& entry_name, const std::string& title) = 0;
    virtual void set_section_entry_icon(const std::string& entry_name, const std::string& icon) = 0;
    virtual void set_section_entry_enabled(const std::string& entry_name, bool flag) = 0;
    virtual void mark_section_busy(const std::string& section_name, bool busy) = 0;
    virtual void remove_section_entry(const std::string& entry_name) = 0;

    virtual void set_collapse_states(const std::string& data)= 0;
    virtual std::string get_collapse_states()= 0;

    virtual void clear_sections() = 0;
    virtual void clear_section(const std::string& section_name) = 0;
    virtual void set_selection_color (const std::string& color) = 0;
    virtual void set_selection_color (const mforms::SystemColor color) = 0;

    virtual int select_entry(const std::string& entry_name) = 0;
    virtual std::string selected_entry() = 0;
    virtual void clear_selection() = 0;

    boost::signals2::signal<void (const std::string&)>* on_section_command() { return &_on_section_command;};

  public: // Only for advanced sidebar
    virtual void set_schema_model(wb::LiveSchemaTree* model) {}
    virtual void set_filtered_schema_model(wb::LiveSchemaTree* model) {}
    virtual void enable_server_search(bool enabled) {}

    virtual TreeNodeView *get_schema_tree() { return NULL; }
    virtual TextEntry *get_filter_entry() { return NULL; }

    virtual void expand_schema(int schema_index) {}

    virtual boost::signals2::signal<void (const std::string&)>* signal_filter_changed() { return NULL; }
    virtual boost::signals2::signal<void (void)>* tree_node_selected() { return NULL; }

    virtual mforms::ContextMenu *get_context_menu() { return NULL; }

#ifndef SWIG
    static void register_factory(const std::string &type, TaskSidebar* (*create)());
#endif
  private:
  };
}

#endif // !DOXYGEN_SHOULD_SKIP_THIS