~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to backend/wbprivate/model/wb_component_basic.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright (c) 2007, 2011, 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
 
 
20
#ifndef _WB_COMPONENT_BASIC_H_
 
21
#define _WB_COMPONENT_BASIC_H_
 
22
 
 
23
// Basic Model Handling (layers etc)
 
24
 
 
25
#include "wb_component.h"
 
26
 
 
27
 
 
28
namespace wb {
 
29
 
 
30
  // basic tool names
 
31
  #define WB_TOOL_SELECT     "basic/select"
 
32
  #define WB_TOOL_HAND       "basic/hand"
 
33
  #define WB_TOOL_DELETE     "basic/delete"
 
34
  #define WB_TOOL_LAYER      "basic/layer"
 
35
  #define WB_TOOL_NOTE       "basic/note"
 
36
  #define WB_TOOL_IMAGE      "basic/image"
 
37
  #define WB_TOOL_ZOOM_IN    "basic/zoomin"
 
38
  #define WB_TOOL_ZOOM_OUT   "basic/zoomout"
 
39
 
 
40
  class WBComponentBasic : public WBComponent
 
41
  {
 
42
  public:
 
43
    WBComponentBasic(WBContext *wb);
 
44
    virtual ~WBComponentBasic();
 
45
 
 
46
    static std::string name() { return "basic"; }
 
47
    virtual std::string get_name() { return WBComponentBasic::name(); }
 
48
    virtual std::string get_diagram_class_name() { return model_Diagram::static_class_name(); }
 
49
 
 
50
    void delete_selection();
 
51
    
 
52
  protected:
 
53
    virtual void load_app_options(bool update);
 
54
 
 
55
    // Canvas Handling
 
56
    virtual void setup_canvas_tool(ModelDiagramForm *view, const std::string &tool);
 
57
 
 
58
    // Toolbar Handling
 
59
    virtual app_ToolbarRef get_tools_toolbar();
 
60
    virtual app_ToolbarRef get_tool_options(const std::string &tool);
 
61
 
 
62
    virtual std::vector<std::string> get_command_dropdown_items(const std::string &option);
 
63
 
 
64
    virtual grt::ListRef<app_ShortcutItem> get_shortcut_items();
 
65
 
 
66
    virtual bool handles_figure(const model_ObjectRef &object);
 
67
 
 
68
    virtual void activate_canvas_object(const model_ObjectRef &figure, bool newwindow);
 
69
 
 
70
  private:
 
71
    std::map<std::string, app_ToolbarRef> _toolbars;
 
72
    grt::ListRef<app_ShortcutItem> _shortcuts;
 
73
 
 
74
    // Model Objects
 
75
    void place_layer(ModelDiagramForm *view, const MySQL::Geometry::Rect &rect);
 
76
    grt::ValueRef place_layer_grt(grt::GRT *grt, ModelDiagramForm *view, 
 
77
                                      const MySQL::Geometry::Rect &rect);
 
78
 
 
79
    void delete_object(ModelDiagramForm *view, const MySQL::Geometry::Point &pos);
 
80
    virtual model_ObjectRef clone_object(const model_ObjectRef &object, const model_LayerRef &destlayer, grt::CopyContext &copy_context, bool copy_only);
 
81
 
 
82
    virtual bool delete_model_object(const model_ObjectRef &object, std::map<std::string,bool> &options);
 
83
 
 
84
    void reset_tool(ModelDiagramForm *view, void*);
 
85
    bool handle_motion_event(ModelDiagramForm*, MySQL::Geometry::Point, mdc::EventState, void*);
 
86
    bool handle_button_event(ModelDiagramForm*, mdc::MouseButton, bool, MySQL::Geometry::Point, mdc::EventState, void*);
 
87
  };
 
88
 
 
89
};
 
90
 
 
91
 
 
92
#endif