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

« back to all changes in this revision

Viewing changes to library/base/ui_form.cpp

  • 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, 2010, 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
//#include "stdafx.h"
 
21
 
 
22
#include "base/ui_form.h"
 
23
#include "base/string_utilities.h"
 
24
 
 
25
 
 
26
using namespace bec;
 
27
 
 
28
static std::map<std::string, UIForm*> ui_form_instances;
 
29
 
 
30
 
 
31
UIForm::UIForm()
 
32
: _owner_data(0), _frontend_data(0)
 
33
{
 
34
  ui_form_instances[form_id()] = this;
 
35
}
 
36
 
 
37
void UIForm::set_frontend_data(void *data)
 
38
{
 
39
  _frontend_data= data;
 
40
}
 
41
 
 
42
std::string UIForm::form_id()
 
43
{
 
44
  return base::strfmt("<UIForm %p>", this);
 
45
}
 
46
 
 
47
void *UIForm::get_frontend_data()
 
48
{
 
49
  return _frontend_data;
 
50
}
 
51
 
 
52
 
 
53
 
 
54
UIForm::~UIForm()
 
55
{
 
56
  ui_form_instances.erase(ui_form_instances.find(form_id()));
 
57
 
 
58
  if (slot_destroyed)
 
59
    slot_destroyed();
 
60
}
 
61
 
 
62
bec::UIForm *UIForm::form_with_id(const std::string &id)
 
63
{
 
64
  if (ui_form_instances.find(id) != ui_form_instances.end())
 
65
    return ui_form_instances[id];
 
66
  return 0;
 
67
}
 
68
 
 
69
void UIForm::set_owner_data(void *data) { _owner_data= data; }
 
70
void *UIForm::get_owner_data() { return _owner_data; }
 
71
 
 
72
bool UIForm::is_main_form() { return false; }
 
73
 
 
74
// target description for cuy/copy/delete menu items and for paste, after a copy is made
 
75
std::string UIForm::get_edit_target_name() { return ""; }
 
76
 
 
77
bool UIForm::can_undo(/*Clipboard *clip*/) { return false; }
 
78
bool UIForm::can_redo(/*Clipboard *clip*/) { return false; }
 
79
bool UIForm::can_cut(/*Clipboard *clip*/) { return can_copy() && can_delete(); }
 
80
bool UIForm::can_copy(/*Clipboard *clip*/) { return false; }
 
81
bool UIForm::can_paste(/*Clipboard *clip*/) { return false; }
 
82
bool UIForm::can_delete() { return false; }
 
83
bool UIForm::can_select_all() { return false; }
 
84
 
 
85
void UIForm::undo() {}
 
86
void UIForm::redo() {}
 
87
void UIForm::cut(/*Clipboard *clip*/) {}
 
88
void UIForm::copy(/*Clipboard *clip*/) {}
 
89
void UIForm::paste(/*Clipboard *clip*/) {}
 
90
void UIForm::delete_selection() {}
 
91
void UIForm::select_all() {}