2
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
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
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.
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
20
#ifndef _WB_COMPONENT_BASIC_H_
21
#define _WB_COMPONENT_BASIC_H_
23
// Basic Model Handling (layers etc)
25
#include "wb_component.h"
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"
40
class WBComponentBasic : public WBComponent
43
WBComponentBasic(WBContext *wb);
44
virtual ~WBComponentBasic();
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(); }
50
void delete_selection();
53
virtual void load_app_options(bool update);
56
virtual void setup_canvas_tool(ModelDiagramForm *view, const std::string &tool);
59
virtual app_ToolbarRef get_tools_toolbar();
60
virtual app_ToolbarRef get_tool_options(const std::string &tool);
62
virtual std::vector<std::string> get_command_dropdown_items(const std::string &option);
64
virtual grt::ListRef<app_ShortcutItem> get_shortcut_items();
66
virtual bool handles_figure(const model_ObjectRef &object);
68
virtual void activate_canvas_object(const model_ObjectRef &figure, bool newwindow);
71
std::map<std::string, app_ToolbarRef> _toolbars;
72
grt::ListRef<app_ShortcutItem> _shortcuts;
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);
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 ©_context, bool copy_only);
82
virtual bool delete_model_object(const model_ObjectRef &object, std::map<std::string,bool> &options);
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*);