File: form_view_base.h

package info (click to toggle)
mysql-workbench 6.2.3%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 102,612 kB
  • ctags: 84,593
  • sloc: ansic: 804,682; cpp: 438,759; yacc: 59,129; python: 54,293; xml: 48,851; sql: 5,512; objc: 1,414; makefile: 505; sh: 455; java: 237; ruby: 6; perl: 5; php: 1
file content (80 lines) | stat: -rw-r--r-- 1,940 bytes parent folder | download
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
#ifndef _FORM_VIEW_BASE_H_
#define _FORM_VIEW_BASE_H_

#include <gtkmm/notebook.h>
#include <gtkmm/widget.h>
#include <gtkmm/paned.h>
#include "base/ui_form.h"

namespace bec
{
  class GRTManager;
};

namespace mforms
{
  class ToolBar;
};

class PluginEditorBase;

class FormViewBase
{
protected:
  sigc::signal<void,std::string> _title_changed;
  Gtk::Notebook *_editor_note;

  bec::GRTManager *_grtm;
  mforms::ToolBar *_toolbar;
  Gtk::HPaned *_sidebar1_pane;
  Gtk::HPaned *_sidebar2_pane;
  std::string _panel_savename;
 
  FormViewBase(const std::string &savename) : _editor_note(0), _grtm(0), _sidebar1_pane(0), _sidebar2_pane(0), _panel_savename(savename) {}

public:
  sigc::signal<void,std::string> signal_title_changed() { return _title_changed; }

  std::string get_title() { return get_form()->get_title(); }
  virtual Gtk::Widget *get_panel()= 0;

  virtual bec::UIForm *get_form() const= 0;
  
  virtual bool on_close() { return true; }
  virtual void on_activate() {}

  virtual void toggle_sidebar(bool show);
  virtual void toggle_secondary_sidebar(bool show);
  
  virtual void reset_layout() {}
  // close the selected tab and return true or false if no tab is active
  virtual bool close_focused_tab();

  virtual void find_text(const std::string &text) {}

  virtual void dispose() {}

  virtual bool perform_command(const std::string &cmd);

protected:
  bool close_plugin_tab(PluginEditorBase *editor);
  
  sigc::slot<void, PluginEditorBase*> _close_editor;

  virtual void plugin_tab_added(PluginEditorBase *plugin) {};

public:
  void set_close_editor_callback(const sigc::slot<void, PluginEditorBase*> &handler);

  void add_plugin_tab(PluginEditorBase *plugin);
  void remove_plugin_tab(PluginEditorBase *plugin);
  bool close_editors_for_object(const std::string &id);

  PluginEditorBase *get_focused_plugin_tab();

  void sidebar_resized(bool primary);
  virtual void restore_sidebar_layout();
};

#endif