~ubuntu-branches/ubuntu/quantal/glom/quantal

« back to all changes in this revision

Viewing changes to glom/utility_widgets/flowtablewithfields.h

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane
  • Date: 2009-01-11 17:12:01 UTC
  • mfrom: (1.1.39 upstream)
  • Revision ID: james.westby@ubuntu.com-20090111171201-0ov9zh1fxfueshxc
Tags: 1.8.5-0ubuntu1
* New upstream release (LP: #256701), fixes LP bugs: 
  + Clear the text in property dialogs for text items (LP: #309147)
  + Don't crash when showing and then hiding the grid (LP: #303453)
  + Temporarily remember the sort order so it is the same when navigating 
    away and back (LP: #303422)
  + Use the list's sort order for the top-level records in the report 
    (LP: #303425)
  + Users/Groups: Disable drag-and-drop for the treeview, because it is
    useless and confusing (LP: #299573)
  + Import: Sort the fields list alphabetically (LP: #306593)
  + delete primary key make unusuable the database (LP: #299549)
  + Spanish translate incomplete (LP: #299556)
  + import date format error (LP: #299591)
  + can't delete data from table list view (LP: #299853)
  + Field definition: default value not saved (LP: #299896)
  + reports crashing (LP: #300054)
  + Year error with date fields (LP: #300057)
  + list view: 2 records added instead of 1 (LP: #300819)
* debian/control: Refreshed dependencies for libglom-dev.
* debian/control: Updated build-deps to match configure checks. goocavnasmm
  build-dep bumped to version without .la files.
* debian/rules: Don't delete the directory containing the templates.
* debian/control, debian/rules, debian/glom-doc.*: Split out
  arch-independent manual and examples into separate package glom-doc, which
  is now recommended by glom (glom will still work if they're not available)
* debian/copyright: Rewritten to new machine-readable format. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Glom
2
 
 *
3
 
 * Copyright (C) 2001-2004 Murray Cumming
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU General Public License as
7
 
 * published by the Free Software Foundation; either version 2 of the
8
 
 * License, or (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful, but
11
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public
16
 
 * License along with this program; if not, write to the
17
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
 
 * Boston, MA 02111-1307, USA.
19
 
 */
20
 
 
21
 
#ifndef GLOM_UTILITYWIDGETS_FLOWTABLEWITHFIELDS_H
22
 
#define GLOM_UTILITYWIDGETS_FLOWTABLEWITHFIELDS_H
23
 
 
24
 
#include "flowtable.h"
25
 
#include <glom/libglom/data_structure/layout/layoutgroup.h>
26
 
#include <glom/libglom/data_structure/layout/layoutitem_field.h>
27
 
#include <glom/libglom/data_structure/layout/layoutitem_notebook.h>
28
 
#include <glom/libglom/data_structure/layout/layoutitem_portal.h>
29
 
#include <glom/libglom/data_structure/layout/layoutitem_button.h>
30
 
#include <glom/libglom/data_structure/layout/layoutitem_text.h>
31
 
#include <glom/libglom/data_structure/field.h>
32
 
#include <glom/libglom/document/document_glom.h>
33
 
#include "../mode_data/box_data_list_related.h"
34
 
#include "layoutwidgetbase.h"
35
 
#include "../mode_data/treestore_layout.h" //Forthe enum.
36
 
#include <map>
37
 
#include <list>
38
 
 
39
 
namespace Glom
40
 
{
41
 
 
42
 
class DataWidget;
43
 
 
44
 
class FlowTableWithFields
45
 
  : public FlowTable,
46
 
    public View_Composite_Glom,
47
 
    public LayoutWidgetBase
48
 
{
49
 
public: 
50
 
  FlowTableWithFields(const Glib::ustring& table_name = Glib::ustring());
51
 
  virtual ~FlowTableWithFields();
52
 
 
53
 
  ///The table name is needed to discover details of relationships.
54
 
  virtual void set_table(const Glib::ustring& table_name);
55
 
 
56
 
  /** Add a field.
57
 
   * @param layoutitem_field The layout item that describes this field,
58
 
   * @param table_name The table on which this layout appears.
59
 
   */
60
 
  virtual void add_field(const sharedptr<LayoutItem_Field>& layoutitem_field, const Glib::ustring& table_name);
61
 
  virtual void remove_field(const Glib::ustring& id);
62
 
 
63
 
  typedef std::map<int, Field> type_map_field_sequence;
64
 
  //virtual void add_group(const Glib::ustring& group_name, const Glib::ustring& group_title, const type_map_field_sequence& fields);
65
 
 
66
 
  virtual void add_layout_item(const sharedptr<LayoutItem>& item);
67
 
  virtual void add_layout_group(const sharedptr<LayoutGroup>& group);
68
 
 
69
 
  virtual void set_field_editable(const sharedptr<const LayoutItem_Field>& field, bool editable = true);
70
 
 
71
 
  virtual Gnome::Gda::Value get_field_value(const sharedptr<const LayoutItem_Field>& field) const;
72
 
  //virtual Gnome::Gda::Value get_field_value(const Glib::ustring& id) const;
73
 
  virtual void set_field_value(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
74
 
  //virtual void set_field_value(const Glib::ustring& id, const Gnome::Gda::Value& value);
75
 
 
76
 
 
77
 
  typedef std::list<Gtk::Widget*> type_list_widgets;
78
 
  typedef std::list<const Gtk::Widget*> type_list_const_widgets;
79
 
 
80
 
  virtual void change_group(const Glib::ustring& id, const Glib::ustring& new_group);
81
 
 
82
 
  virtual void set_design_mode(bool value = true);
83
 
 
84
 
  virtual void remove_all();
85
 
 
86
 
  /** Get the layout structure, which might have changed in the child widgets since 
87
 
   * the whole widget structure was built.
88
 
   * for instance, if the user chose a new field for a DataWidget, 
89
 
   * or a new relationship for a portal.
90
 
   */
91
 
  //void get_layout_groups(Document_Glom::type_mapLayoutGroupSequence& groups);
92
 
  //sharedptr<LayoutGroup> get_layout_group();
93
 
 
94
 
  /** For instance,
95
 
   * void on_flowtable_field_edited(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
96
 
   */
97
 
  typedef sigc::signal<void, const sharedptr<const LayoutItem_Field>&, const Gnome::Gda::Value&> type_signal_field_edited;
98
 
  type_signal_field_edited signal_field_edited();
99
 
  
100
 
  /** For instance,
101
 
   * void on_flowtable_field_open_details_requested(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
102
 
   */
103
 
  typedef sigc::signal<void, const sharedptr<const LayoutItem_Field>&, const Gnome::Gda::Value&> type_signal_field_open_details_requested;
104
 
  type_signal_field_open_details_requested signal_field_open_details_requested();
105
 
 
106
 
  /** For instance,
107
 
   * void on_related_record_changed(const Glib::ustring& relationship_name);
108
 
   */
109
 
  typedef sigc::signal<void, const Glib::ustring&> type_signal_related_record_changed;
110
 
  type_signal_related_record_changed signal_related_record_changed();
111
 
 
112
 
  /** For instance,
113
 
   * void on_requested_related_details(const Glib::ustring& table_name, Gnome::Gda::Value primary_key_value);
114
 
   */
115
 
  typedef sigc::signal<void, const Glib::ustring&, Gnome::Gda::Value> type_signal_requested_related_details;
116
 
  type_signal_requested_related_details signal_requested_related_details();
117
 
 
118
 
 /** For instance,
119
 
   * void on_script_button_clicked(const sharedptr<LayoutItem_Button>& layout_item>);
120
 
   */
121
 
  typedef sigc::signal<void, const sharedptr<LayoutItem_Button>&> type_signal_script_button_clicked;
122
 
  type_signal_script_button_clicked signal_script_button_clicked();
123
 
 
124
 
protected:
125
 
 
126
 
  virtual type_list_widgets get_field(const sharedptr<const LayoutItem_Field>& field);
127
 
  virtual type_list_const_widgets get_field(const sharedptr<const LayoutItem_Field>& field) const;
128
 
 
129
 
  ///Get portals whose relationships have @a from_key as the from_key.
130
 
  virtual type_list_widgets get_portals(const sharedptr<const LayoutItem_Field>& from_key);
131
 
 
132
 
  //int get_suitable_width(Field::glom_field_type field_type);
133
 
 
134
 
  void on_entry_edited(const Gnome::Gda::Value& value, sharedptr<const LayoutItem_Field> field);
135
 
  void on_entry_open_details_requested(const Gnome::Gda::Value& value, sharedptr<const LayoutItem_Field> field);
136
 
  void on_flowtable_entry_edited(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
137
 
  void on_flowtable_entry_open_details_requested(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value); 
138
 
 
139
 
  void on_portal_record_changed(const Glib::ustring& relationship_name);
140
 
  void on_flowtable_related_record_changed(const Glib::ustring& relationship_name);
141
 
  void on_flowtable_requested_related_details(const Glib::ustring& table_name, Gnome::Gda::Value primary_key_value);
142
 
 
143
 
  void on_script_button_clicked(const sharedptr<LayoutItem_Button>& layout_item);
144
 
 
145
 
  /// Remember the layout widget so we can iterate through them later.
146
 
  void on_layoutwidget_changed();
147
 
 
148
 
  void on_datawidget_layout_item_added(LayoutWidgetBase::enumType item_type, DataWidget* pDataWidget);
149
 
 
150
 
  void on_portal_user_requested_details(Gnome::Gda::Value primary_key_value, Box_Data_List_Related* portal_box);
151
 
 
152
 
  class Info
153
 
  {
154
 
  public:
155
 
    Info();
156
 
 
157
 
    sharedptr<const LayoutItem_Field> m_field; //Store the field information so we know the title, ID, and type.
158
 
    Glib::ustring m_group;
159
 
 
160
 
    Gtk::Label* m_first;
161
 
    DataWidget* m_second;
162
 
    Gtk::CheckButton* m_checkbutton; //Used instead of first and second if it's a bool.
163
 
  };
164
 
 
165
 
  typedef std::list<Info> type_listFields; //Map of IDs to full info.
166
 
  type_listFields m_listFields;
167
 
 
168
 
  //Remember the nested FlowTables, so that we can search them for fields too:
169
 
  typedef std::list< FlowTableWithFields* > type_sub_flow_tables;
170
 
  type_sub_flow_tables m_sub_flow_tables;
171
 
 
172
 
  typedef std::list< Box_Data_List_Related* > type_portals;
173
 
  type_portals m_portals;
174
 
 
175
 
  //Remember the sequence of LayoutWidgetBase widgets, so we can iterate over them later:
176
 
  typedef std::list< LayoutWidgetBase* > type_list_layoutwidgets;
177
 
  type_list_layoutwidgets m_list_layoutwidgets;
178
 
 
179
 
  void add_field_at_position(const sharedptr<LayoutItem_Field>& layoutitem_field, const Glib::ustring& table_name, const type_list_layoutwidgets::iterator& add_before);
180
 
  void add_button_at_position(const sharedptr<LayoutItem_Button>& layoutitem_button, const Glib::ustring& table_name, const type_list_layoutwidgets::iterator& add_before);
181
 
  void add_textobject_at_position(const sharedptr<LayoutItem_Text>& layoutitem_text, const Glib::ustring& table_name, const type_list_layoutwidgets::iterator& add_before);
182
 
  void add_imageobject_at_position(const sharedptr<LayoutItem_Image>& layoutitem_image, const Glib::ustring& table_name, const type_list_layoutwidgets::iterator& add_before);
183
 
 
184
 
  void add_layoutwidgetbase(LayoutWidgetBase* layout_widget);
185
 
  void add_layoutwidgetbase(LayoutWidgetBase* layout_widget, const type_list_layoutwidgets::iterator& add_before);
186
 
  void add_layout_item_at_position(const sharedptr<LayoutItem>& item, const type_list_layoutwidgets::iterator& add_before);
187
 
  void add_layout_group_at_position(const sharedptr<LayoutGroup>& group, const type_list_layoutwidgets::iterator& add_before);
188
 
  void add_layout_notebook_at_position(const sharedptr<LayoutItem_Notebook>& notebook, const type_list_layoutwidgets::iterator& add_before);
189
 
  void add_layout_related_at_position(const sharedptr<LayoutItem_Portal>& portal, const type_list_layoutwidgets::iterator& add_before);
190
 
 
191
 
  Box_Data_List_Related* create_related(const sharedptr<LayoutItem_Portal>& portal, bool show_title = true);
192
 
 
193
 
  Glib::ustring m_table_name;
194
 
 
195
 
  type_signal_field_edited m_signal_field_edited;
196
 
  type_signal_field_open_details_requested m_signal_field_open_details_requested;
197
 
 
198
 
  //type_signal_related_record_added m_signal_related_record_added;
199
 
  type_signal_related_record_changed m_signal_related_record_changed;
200
 
  type_signal_requested_related_details m_signal_requested_related_details;
201
 
 
202
 
  type_signal_script_button_clicked m_signal_script_button_clicked;
203
 
};
204
 
 
205
 
} //namespace Glom
206
 
 
207
 
#endif //GLOM_UTILITYWIDGETS_FLOWTABLEWITHFIELDS_H