1
by Thomas Jaeger
Import upstream version 0.2.2 |
1 |
/*
|
1.1.3
by Thomas Jaeger
Import upstream version 0.4.0.98.1 |
2 |
* Copyright (c) 2008-2009, Thomas Jaeger <ThJaeger@gmail.com>
|
1
by Thomas Jaeger
Import upstream version 0.2.2 |
3 |
*
|
4 |
* Permission to use, copy, modify, and/or distribute this software for any
|
|
5 |
* purpose with or without fee is hereby granted, provided that the above
|
|
6 |
* copyright notice and this permission notice appear in all copies.
|
|
7 |
*
|
|
8 |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9 |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10 |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
11 |
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12 |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
13 |
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
14 |
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15 |
*/
|
|
16 |
#ifndef __ACTIONS_H__
|
|
17 |
#define __ACTIONS_H__
|
|
18 |
||
19 |
#include <gtkmm.h> |
|
20 |
||
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
21 |
class Unique; |
1
by Thomas Jaeger
Import upstream version 0.2.2 |
22 |
class Win; |
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
23 |
class ActionListDiff; |
1
by Thomas Jaeger
Import upstream version 0.2.2 |
24 |
|
1.1.5
by Thomas Jaeger
Import upstream version 0.4.4 |
25 |
class TreeViewMulti : public Gtk::TreeView { |
26 |
bool pending; |
|
27 |
Gtk::TreePath path; |
|
28 |
Gtk::TreeViewColumn *column; |
|
29 |
virtual bool on_button_press_event(GdkEventButton* event); |
|
30 |
virtual bool on_button_release_event(GdkEventButton* event); |
|
31 |
virtual void on_drag_begin(const Glib::RefPtr<Gdk::DragContext> &context); |
|
32 |
public: |
|
33 |
TreeViewMulti(); |
|
34 |
};
|
|
35 |
||
1
by Thomas Jaeger
Import upstream version 0.2.2 |
36 |
class Actions { |
37 |
public: |
|
38 |
Actions(); |
|
39 |
private: |
|
40 |
void on_button_delete(); |
|
41 |
void on_button_new(); |
|
42 |
void on_button_record(); |
|
43 |
void on_selection_changed(); |
|
44 |
void on_cursor_changed(); |
|
45 |
void on_name_edited(const Glib::ustring& path, const Glib::ustring& new_text); |
|
1.1.3
by Thomas Jaeger
Import upstream version 0.4.0.98.1 |
46 |
void on_text_edited(const Glib::ustring& path, const Glib::ustring& new_text); |
1
by Thomas Jaeger
Import upstream version 0.2.2 |
47 |
void on_type_edited(const Glib::ustring& path, const Glib::ustring& new_text); |
48 |
void on_accel_edited(const Glib::ustring& path_string, guint accel_key, Gdk::ModifierType accel_mods, guint hardware_keycode); |
|
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
49 |
void on_combo_edited(const Glib::ustring& path_string, guint item); |
1
by Thomas Jaeger
Import upstream version 0.2.2 |
50 |
void on_arg_editing_started(Gtk::CellEditable* editable, const Glib::ustring& path); |
51 |
void on_something_editing_started(Gtk::CellEditable* editable, const Glib::ustring& path); |
|
52 |
void on_something_editing_canceled(); |
|
53 |
void on_row_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column); |
|
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
54 |
void on_cell_data_name(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); |
55 |
void on_cell_data_type(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); |
|
56 |
void on_cell_data_arg(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); |
|
57 |
int compare_ids(const Gtk::TreeModel::iterator &a, const Gtk::TreeModel::iterator &b); |
|
1
by Thomas Jaeger
Import upstream version 0.2.2 |
58 |
class OnStroke; |
59 |
Gtk::TreeRow get_selected_row(); |
|
60 |
||
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
61 |
void focus(Unique *id, int col, bool edit); |
1.1.3
by Thomas Jaeger
Import upstream version 0.4.0.98.1 |
62 |
bool do_focus(Unique *id, Gtk::TreeViewColumn *col, bool edit); |
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
63 |
|
1.1.3
by Thomas Jaeger
Import upstream version 0.4.0.98.1 |
64 |
bool select_app(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iter, ActionListDiff *actions); |
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
65 |
void on_add_app(); |
66 |
void on_add_group(); |
|
67 |
void on_group_name_edited(const Glib::ustring& path, const Glib::ustring& new_text); |
|
68 |
void on_apps_selection_changed(); |
|
69 |
void load_app_list(const Gtk::TreeNodeChildren &ch, ActionListDiff *actions); |
|
70 |
void on_cell_data_apps(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); |
|
71 |
void update_action_list(); |
|
72 |
void update_row(const Gtk::TreeRow &row); |
|
1.1.7
by Thomas Jaeger
Import upstream version 0.5.2 |
73 |
bool count_app_actions(const Gtk::TreeIter &i); |
74 |
void update_counts(); |
|
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
75 |
void on_reset_actions(); |
76 |
void on_remove_app(); |
|
1
by Thomas Jaeger
Import upstream version 0.2.2 |
77 |
|
78 |
class ModelColumns : public Gtk::TreeModel::ColumnRecord { |
|
79 |
public: |
|
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
80 |
ModelColumns() { |
81 |
add(stroke); add(name); add(type); add(arg); add(cmd_save); add(id); |
|
82 |
add(name_bold); add(action_bold); add(deactivated); |
|
83 |
}
|
|
1
by Thomas Jaeger
Import upstream version 0.2.2 |
84 |
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > stroke; |
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
85 |
Gtk::TreeModelColumn<Glib::ustring> name, type, arg, cmd_save; |
86 |
Gtk::TreeModelColumn<Unique *> id; |
|
87 |
Gtk::TreeModelColumn<bool> name_bold, action_bold; |
|
88 |
Gtk::TreeModelColumn<bool> deactivated; |
|
89 |
};
|
|
90 |
class Store : public Gtk::ListStore { |
|
91 |
Actions *parent; |
|
92 |
public: |
|
93 |
Store(const Gtk::TreeModelColumnRecord &columns, Actions *p) : Gtk::ListStore(columns), parent(p) {} |
|
94 |
static Glib::RefPtr<Store> create(const Gtk::TreeModelColumnRecord &columns, Actions *parent) { |
|
95 |
return Glib::RefPtr<Store>(new Store(columns, parent)); |
|
96 |
}
|
|
97 |
protected: |
|
98 |
bool row_draggable_vfunc(const Gtk::TreeModel::Path &path) const; |
|
99 |
bool row_drop_possible_vfunc(const Gtk::TreeModel::Path &dest, const Gtk::SelectionData &selection) const; |
|
100 |
bool drag_data_received_vfunc(const Gtk::TreeModel::Path &dest, const Gtk::SelectionData& selection); |
|
1
by Thomas Jaeger
Import upstream version 0.2.2 |
101 |
};
|
1.1.3
by Thomas Jaeger
Import upstream version 0.4.0.98.1 |
102 |
class AppsStore : public Gtk::TreeStore { |
103 |
Actions *parent; |
|
104 |
public: |
|
105 |
AppsStore(const Gtk::TreeModelColumnRecord &columns, Actions *p) : Gtk::TreeStore(columns), parent(p) {} |
|
106 |
static Glib::RefPtr<AppsStore> create(const Gtk::TreeModelColumnRecord &columns, Actions *parent) { |
|
107 |
return Glib::RefPtr<AppsStore>(new AppsStore(columns, parent)); |
|
108 |
}
|
|
109 |
protected: |
|
110 |
bool row_drop_possible_vfunc(const Gtk::TreeModel::Path &dest, const Gtk::SelectionData &selection) const; |
|
111 |
bool drag_data_received_vfunc(const Gtk::TreeModel::Path &dest, const Gtk::SelectionData& selection); |
|
112 |
};
|
|
1
by Thomas Jaeger
Import upstream version 0.2.2 |
113 |
ModelColumns cols; |
1.1.5
by Thomas Jaeger
Import upstream version 0.4.4 |
114 |
TreeViewMulti tv; |
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
115 |
Glib::RefPtr<Store> tm; |
116 |
||
117 |
Gtk::TreeView *apps_view; |
|
1.1.3
by Thomas Jaeger
Import upstream version 0.4.0.98.1 |
118 |
Glib::RefPtr<AppsStore> apps_model; |
1
by Thomas Jaeger
Import upstream version 0.2.2 |
119 |
|
120 |
class Single : public Gtk::TreeModel::ColumnRecord { |
|
121 |
public: |
|
122 |
Single() { add(type); } |
|
123 |
Gtk::TreeModelColumn<Glib::ustring> type; |
|
124 |
};
|
|
125 |
Single type; |
|
126 |
||
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
127 |
class Apps : public Gtk::TreeModel::ColumnRecord { |
128 |
public: |
|
1.1.7
by Thomas Jaeger
Import upstream version 0.5.2 |
129 |
Apps() { add(app); add(actions); add(count); } |
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
130 |
Gtk::TreeModelColumn<Glib::ustring> app; |
131 |
Gtk::TreeModelColumn<ActionListDiff *> actions; |
|
1.1.7
by Thomas Jaeger
Import upstream version 0.5.2 |
132 |
Gtk::TreeModelColumn<int> count; |
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
133 |
};
|
134 |
Apps ca; |
|
135 |
||
1
by Thomas Jaeger
Import upstream version 0.2.2 |
136 |
struct Focus; |
137 |
||
138 |
Glib::RefPtr<Gtk::ListStore> type_store; |
|
139 |
||
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
140 |
Gtk::Button *button_record, *button_delete, *button_remove_app, *button_reset_actions; |
141 |
Gtk::CheckButton *check_show_deleted; |
|
142 |
Gtk::Expander *expander_apps; |
|
1
by Thomas Jaeger
Import upstream version 0.2.2 |
143 |
|
144 |
bool editing_new; |
|
145 |
bool editing; |
|
1.1.3
by Thomas Jaeger
Import upstream version 0.4.0.98.1 |
146 |
|
1.1.2
by Thomas Jaeger
Import upstream version 0.3.98.1 |
147 |
ActionListDiff *action_list; |
1
by Thomas Jaeger
Import upstream version 0.2.2 |
148 |
};
|
149 |
||
150 |
#endif
|