/[svn]/gigedit/trunk/src/gigedit/dimensionmanager.h
ViewVC logotype

Annotation of /gigedit/trunk/src/gigedit/dimensionmanager.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3068 - (hide annotations) (download) (as text)
Mon Jan 2 22:13:01 2017 UTC (7 years, 3 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 4787 byte(s)
- Preparations for Xcode project update.

1 schoenebeck 1225 /* -*- c++ -*-
2 schoenebeck 3068 * Copyright (C) 2006 - 2017 Andreas Persson
3 schoenebeck 1225 *
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; either version 2, or (at
7     * your option) any later version.
8     *
9     * This program is distributed in the hope that it will be useful, but
10     * WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12     * General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with program; see the file COPYING. If not, write to the Free
16     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17     * 02110-1301 USA.
18     */
19    
20     #ifndef GIGEDIT_DIMENSIONMANAGER_H
21     #define GIGEDIT_DIMENSIONMANAGER_H
22    
23 persson 2579 #include <glibmm/property.h>
24 persson 2844 #include <gtkmm/box.h>
25 schoenebeck 1225 #include <gtkmm/window.h>
26     #include <gtkmm/layout.h>
27     #include <gtkmm/button.h>
28     #include <gtkmm/buttonbox.h>
29     #include <gtkmm/treeview.h>
30     #include <gtkmm/liststore.h>
31     #include <gtkmm/scrolledwindow.h>
32 schoenebeck 2562 #include <gtkmm/checkbutton.h>
33 schoenebeck 1225
34 schoenebeck 3068 #ifdef LIBGIG_HEADER_FILE
35     # include LIBGIG_HEADER_FILE(gig.h)
36     #else
37     # include <gig.h>
38     #endif
39    
40 schoenebeck 2562 #include <set>
41 schoenebeck 2894 #include "ManagedWindow.h"
42 schoenebeck 1225
43 schoenebeck 2562 class DimTypeCellRenderer : public Gtk::CellRendererText {
44     public:
45     Glib::PropertyProxy<gig::dimension_t> propertyDimType() {
46     return m_propertyDimType.get_proxy();
47     }
48    
49     Glib::PropertyProxy<int> propertyUsageCount() {
50     return m_propertyUsageCount.get_proxy();
51     }
52    
53     Glib::PropertyProxy<int> propertyTotalRegions() {
54     return m_propertyTotalRegions.get_proxy();
55     }
56    
57     DimTypeCellRenderer();
58     protected:
59     void typeChanged();
60     void statsChanged();
61     private:
62     Glib::Property<gig::dimension_t> m_propertyDimType;
63     Glib::Property<int> m_propertyUsageCount;
64     Glib::Property<int> m_propertyTotalRegions;
65     };
66    
67     class IntSetCellRenderer : public Gtk::CellRendererText {
68     public:
69     Glib::PropertyProxy<std::set<int> > propertyValue() {
70     return m_propertyValue.get_proxy();
71     }
72    
73     IntSetCellRenderer();
74     protected:
75     void valueChanged();
76     private:
77     Glib::Property<std::set<int> > m_propertyValue;
78     };
79    
80 schoenebeck 2894 class DimensionManager : public ManagedWindow {
81 schoenebeck 1225 public:
82 schoenebeck 1322 sigc::signal<void, gig::Region*> region_to_be_changed_signal;
83     sigc::signal<void, gig::Region*> region_changed_signal;
84 schoenebeck 1225
85     DimensionManager();
86     void show(gig::Region* region);
87 persson 1677 void set_region(gig::Region* region);
88 schoenebeck 2894
89     // implementation for abstract methods of interface class "ManagedWindow"
90     virtual Settings::Property<int>* windowSettingX() { return &Settings::singleton()->dimensionManagerWindowX; }
91     virtual Settings::Property<int>* windowSettingY() { return &Settings::singleton()->dimensionManagerWindowY; }
92     virtual Settings::Property<int>* windowSettingWidth() { return &Settings::singleton()->dimensionManagerWindowW; }
93     virtual Settings::Property<int>* windowSettingHeight() { return &Settings::singleton()->dimensionManagerWindowH; }
94    
95 schoenebeck 1225 protected:
96     gig::Region* region;
97     Gtk::VBox vbox;
98     Gtk::HButtonBox buttonBox;
99     Gtk::ScrolledWindow scrolledWindow;
100     Gtk::TreeView treeView;
101     Gtk::Button addButton;
102     Gtk::Button removeButton;
103 schoenebeck 2562 Gtk::CheckButton allRegionsCheckBox;
104 schoenebeck 1225
105 schoenebeck 2562 DimTypeCellRenderer m_cellRendererDimType;
106     IntSetCellRenderer m_cellRendererIntSet;
107    
108 schoenebeck 1225 class ModelColumns : public Gtk::TreeModel::ColumnRecord {
109     public:
110     ModelColumns() {
111 schoenebeck 2562 add(m_type);
112 schoenebeck 1225 add(m_bits);
113     add(m_zones);
114     add(m_description);
115 schoenebeck 2562 add(m_usageCount);
116     add(m_totalRegions);
117 schoenebeck 1225 }
118    
119 schoenebeck 2562 Gtk::TreeModelColumn<gig::dimension_t> m_type;
120     Gtk::TreeModelColumn<std::set<int> > m_bits;
121     Gtk::TreeModelColumn<std::set<int> > m_zones;
122 schoenebeck 1225 Gtk::TreeModelColumn<Glib::ustring> m_description;
123 schoenebeck 2562 Gtk::TreeModelColumn<int> m_usageCount;
124     Gtk::TreeModelColumn<int> m_totalRegions;
125 schoenebeck 1225 } tableModel;
126    
127     class ComboModelColumns : public Gtk::TreeModel::ColumnRecord {
128     public:
129     ComboModelColumns() {
130     add(m_type_id);
131     add(m_type_name);
132     }
133    
134     Gtk::TreeModelColumn<int> m_type_id;
135     Gtk::TreeModelColumn<Glib::ustring> m_type_name;
136     } comboModel;
137    
138     Glib::RefPtr<Gtk::ListStore> refTableModel;
139 schoenebeck 2641 bool ignoreColumnClicked; //HACK: Prevents that onColumnClicked() gets called multiple times or at times where it is not desired
140 schoenebeck 1225
141 schoenebeck 2562 void onAllRegionsCheckBoxToggled();
142 schoenebeck 2641 void onColumnClicked();
143 schoenebeck 1225 void refreshManager();
144     void addDimension();
145     void removeDimension();
146 schoenebeck 2562 bool allRegions() const;
147 schoenebeck 1225 };
148    
149     #endif // GIGEDIT_DIMENSIONMANAGER_H

  ViewVC Help
Powered by ViewVC