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
21
#include "note_figure.h"
23
using namespace wbfig;
24
using namespace MySQL::Geometry;
25
using namespace MySQL::Drawing;
27
Note::Note(mdc::Layer *layer, FigureEventHub *hub, const model_ObjectRef &self)
28
: BaseFigure(layer, hub, self), _text(layer)
30
set_allowed_resizing(true, true);
31
set_accepts_focus(true);
32
set_accepts_selection(true);
33
set_auto_sizing(true);
35
set_border_color(Color(0.5, 0.5, 0.5, 0.2));
36
set_background_color(Color::White());
37
set_draw_background(true);
39
_text.set_padding(8, 8);
40
_text.set_font(mdc::FontSpec(DEFAULT_FONT_FACE, mdc::SNormal, mdc::WNormal, 11));
41
_text.set_pen_color(Color::Black());
42
_text.set_multi_line(true);
44
add(&_text, false, false, true);
53
void Note::set_text(const std::string &text)
60
void Note::set_text_color(const Color &color)
62
_text.set_pen_color(color);
66
void Note::set_content_font(const mdc::FontSpec &font)
72
//--------------------------------------------------------------------------------------------------
74
bool Note::on_click(mdc::CanvasItem *target, const Point &point, mdc::MouseButton button, mdc::EventState state)
76
if (!_hub->figure_click(represented_object(), target, point, button, state))
77
return super::on_click(target, point, button, state);
81
//--------------------------------------------------------------------------------------------------
83
bool Note::on_double_click(mdc::CanvasItem *target, const Point &point, mdc::MouseButton button, mdc::EventState state)
85
if (!_hub->figure_double_click(represented_object(), target, point, button, state))
86
return super::on_double_click(target, point, button, state);
90
//--------------------------------------------------------------------------------------------------