2
* Copyright (c) 2007, 2010, 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
22
#include "base/ui_form.h"
23
#include "base/string_utilities.h"
28
static std::map<std::string, UIForm*> ui_form_instances;
32
: _owner_data(0), _frontend_data(0)
34
ui_form_instances[form_id()] = this;
37
void UIForm::set_frontend_data(void *data)
42
std::string UIForm::form_id()
44
return base::strfmt("<UIForm %p>", this);
47
void *UIForm::get_frontend_data()
49
return _frontend_data;
56
ui_form_instances.erase(ui_form_instances.find(form_id()));
62
bec::UIForm *UIForm::form_with_id(const std::string &id)
64
if (ui_form_instances.find(id) != ui_form_instances.end())
65
return ui_form_instances[id];
69
void UIForm::set_owner_data(void *data) { _owner_data= data; }
70
void *UIForm::get_owner_data() { return _owner_data; }
72
bool UIForm::is_main_form() { return false; }
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 ""; }
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; }
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() {}