GnuCash  5.6-150-g038405b370+
gnucash-item-edit.h
Go to the documentation of this file.
1 /********************************************************************\
2  * This program is free software; you can redistribute it and/or *
3  * modify it under the terms of the GNU General Public License as *
4  * published by the Free Software Foundation; either version 2 of *
5  * the License, or (at your option) any later version. *
6  * *
7  * This program is distributed in the hope that it will be useful, *
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
10  * GNU General Public License for more details. *
11  * *
12  * You should have received a copy of the GNU General Public License*
13  * along with this program; if not, contact: *
14  * *
15  * Free Software Foundation Voice: +1-617-542-5942 *
16  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
17  * Boston, MA 02110-1301, USA gnu@gnu.org *
18  * *
19 \********************************************************************/
20 
21 #ifndef GNUCASH_ITEM_EDIT_H
22 #define GNUCASH_ITEM_EDIT_H
23 
24 #include <gtk/gtk.h>
25 #include "gnucash-date-picker.h"
26 #include "gnucash-item-list.h"
27 #include "gnucash-sheet.h"
35 #define GNC_TYPE_ITEM_EDIT (gnc_item_edit_get_type ())
36 #define GNC_ITEM_EDIT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_EDIT, GncItemEdit))
37 #define GNC_ITEM_EDIT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT, GncItemEditClass))
38 #define GNC_IS_ITEM_EDIT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_EDIT))
39 
40 #define GNC_TYPE_ITEM_EDIT_TB (gnc_item_edit_tb_get_type ())
41 #define GNC_ITEM_EDIT_TB(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_EDIT_TB, GncItemEditTb))
42 #define GNC_ITEM_EDIT_TB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT_TB, GncItemEditTbClass))
43 #define GNC_IS_ITEM_EDIT_TB(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_EDIT_TB))
44 
45 typedef int (*PopupGetHeight) (GtkWidget *item,
46  int space_available,
47  int row_height,
48  gpointer user_data);
49 
50 typedef int (*PopupAutosize) (GtkWidget *item,
51  int max_width,
52  gpointer user_data);
53 
54 typedef void (*PopupSetFocus) (GtkWidget *item,
55  gpointer user_data);
56 
57 typedef void (*PopupPostShow) (GtkWidget *item,
58  gpointer user_data);
59 
60 typedef int (*PopupGetWidth) (GtkWidget *item,
61  gpointer user_data);
62 
63 typedef struct _PopupToggle PopupToggle;
65 {
66  GtkWidget *ebox;
67  GtkWidget *tbutton;
68  gboolean arrow_down;
69  gboolean signals_connected;
70 };
71 
72 
73 typedef struct
74 {
75  GtkBox hbox;
76  GnucashSheet *sheet;
77 
78  /* The editor whose status we reflect on the sheet */
79  GtkWidget *editor;
80  gulong preedit_length;
81 
82  gboolean is_popup;
83  gboolean show_popup;
84 
85  PopupToggle popup_toggle;
86  GtkWidget *popup_item;
87  PopupGetHeight popup_get_height;
88  PopupAutosize popup_autosize;
89  PopupSetFocus popup_set_focus;
90  PopupPostShow popup_post_show;
91  PopupGetWidth popup_get_width;
92  gpointer popup_user_data;
93  gint popup_returned_height;
94  gint popup_allocation_height;
95  gulong popup_height_signal_id;
96 
97  GtkBorder padding;
98  GtkBorder margin;
99  GtkBorder border;
100  gint button_width;
101 
102  /* Where are we */
103  VirtualLocation virt_loc;
104 
105  SheetBlockStyle *style;
106 } GncItemEdit;
107 
108 typedef struct
109 {
110  GtkBoxClass parent_class;
112 
113 typedef struct
114 {
115  GtkToggleButton tb;
116  GnucashSheet *sheet;
117 } GncItemEditTb;
118 
119 typedef struct
120 {
121  GtkToggleButtonClass parent_class;
122 
123  void (* toggled) (GncItemEditTb *item_edit_tb);
125 
126 typedef enum
127 {
128  left,
129  right,
130  top,
131  bottom,
132  left_right,
133  top_bottom,
134 } Sides;
135 
136 GType gnc_item_edit_get_type (void);
137 
138 void gnc_item_edit_configure (GncItemEdit *item_edit);
139 
140 void gnc_item_edit_get_pixel_coords (GncItemEdit *item_edit,
141  int *x, int *y,
142  int *w, int *h);
143 
144 GtkWidget *gnc_item_edit_new (GnucashSheet *sheet);
145 
146 void gnc_item_edit_set_popup (GncItemEdit *item_edit,
147  GtkWidget *popup_item,
148  PopupGetHeight popup_get_height,
149  PopupAutosize popup_autosize,
150  PopupSetFocus popup_set_focus,
151  PopupPostShow popup_post_show,
152  PopupGetWidth popup_get_width,
153  gpointer popup_user_data);
154 
155 void gnc_item_edit_show_popup (GncItemEdit *item_edit);
156 void gnc_item_edit_hide_popup (GncItemEdit *item_edit);
157 
158 void gnc_item_edit_cut_clipboard (GncItemEdit *item_edit);
159 void gnc_item_edit_copy_clipboard (GncItemEdit *item_edit);
160 void gnc_item_edit_paste_clipboard (GncItemEdit *item_edit);
161 
162 gboolean gnc_item_edit_get_has_selection (GncItemEdit *item_edit);
163 void gnc_item_edit_focus_in (GncItemEdit *item_edit);
164 void gnc_item_edit_focus_out (GncItemEdit *item_edit);
165 
166 gint gnc_item_edit_get_margin (GncItemEdit *item_edit, Sides side);
167 gint gnc_item_edit_get_padding_border (GncItemEdit *item_edit, Sides side);
168 gint gnc_item_edit_get_button_width (GncItemEdit *item_edit);
169 
170 
171 GType gnc_item_edit_tb_get_type (void);
172 GtkWidget *gnc_item_edit_tb_new (GnucashSheet *sheet);
173 
175 #endif /* GNUCASH_ITEM_EDIT_H */
Public Declarations for GncItemList class.
Public declarations of GnucashRegister class.
Public declarations for GncDatePicker class.