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
|
/*
* Copyright (c) 2007, 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
#include "mdc.h"
#include "grtpp.h"
#include "grts/structs.model.h"
#include "wbpublic_public_interface.h"
#include "base_bridge.h"
class WBPUBLICBACKEND_PUBLIC_FUNC ModelBridgeDelegate
{
public:
virtual mdc::CanvasView *create_diagram(const model_DiagramRef &mview)= 0;
virtual void free_canvas_view(mdc::CanvasView *view)= 0;
virtual cairo_surface_t *fetch_image(const std::string &file)= 0;
virtual std::string attach_image(const std::string &name)= 0;
virtual void release_image(const std::string &name)= 0;
};
class WBPUBLICBACKEND_PUBLIC_FUNC model_Model::ImplData : public BridgeBase
{
typedef BridgeBase super;
protected:
model_Model *_owner;
ModelBridgeDelegate *_delegate;
boost::signals2::signal<void (std::string)> _options_changed_signal;
bool _reset_pending;
bool _options_signal_installed;
void member_changed(const std::string &name);
grt::DictRef get_app_options_dict();
void option_changed(grt::internal::OwnedDict *dict, bool added,
const std::string &option);
void list_changed(grt::internal::OwnedList *list, bool added, const grt::ValueRef &value);
virtual GrtObject *get_object() { return _owner; }
public:
ImplData(model_Model *owner);
// void add_diagram(const model_DiagramRef &view);
void remove_diagram(const model_DiagramRef &view);
virtual bool realize();
virtual void unrealize();
void reset_connections();
void reset_figures();
void reset_layers();
std::string common_color_for_db_object(const grt::ObjectRef &object,
const std::string &member);
void update_object_color_in_all_diagrams(const std::string &color,
const std::string &object_member,
const std::string &object_id);
public:
void set_delegate(ModelBridgeDelegate *delegate) { _delegate= delegate; }
ModelBridgeDelegate* get_delegate() { return _delegate; }
app_PageSettingsRef get_page_settings();
std::string get_string_option(const std::string &name, const std::string &defvalue);
int get_int_option(const std::string &name, int defvalue);
boost::signals2::signal<void (std::string)>* signal_options_changed() { return &_options_changed_signal; }
};
|