00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GNUCASH_ITEM_EDIT_H
00022 #define GNUCASH_ITEM_EDIT_H
00023
00024
00025 #include "gnucash-date-picker.h"
00026 #include "gnucash-item-list.h"
00027 #include "gnucash-sheet.h"
00028
00029 #define GNC_TYPE_ITEM_EDIT (gnc_item_edit_get_type ())
00030 #define GNC_ITEM_EDIT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_EDIT, GncItemEdit))
00031 #define GNC_ITEM_EDIT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT, GncItemEditClass))
00032 #define GNC_IS_ITEM_EDIT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_EDIT))
00033
00034
00035 typedef int (*GetPopupHeight) (GnomeCanvasItem *item,
00036 int space_available,
00037 int row_height,
00038 gpointer user_data);
00039
00040 typedef int (*PopupAutosize) (GnomeCanvasItem *item,
00041 int max_width,
00042 gpointer user_data);
00043
00044 typedef void (*PopupSetFocus) (GnomeCanvasItem *item,
00045 gpointer user_data);
00046
00047 typedef void (*PopupPostShow) (GnomeCanvasItem *item,
00048 gpointer user_data);
00049
00050 typedef int (*PopupGetWidth) (GnomeCanvasItem *item,
00051 gpointer user_data);
00052
00053 typedef struct _PopupToggle PopupToggle;
00054 struct _PopupToggle
00055 {
00056 GtkToggleButton *toggle_button;
00057 GnomeCanvasItem *toggle_button_item;
00058
00059 gint toggle_offset;
00060
00061 GtkArrow *arrow;
00062
00063 gboolean signals_connected;
00064 };
00065
00066
00067 typedef struct {
00068 GnomeCanvasItem canvas_item;
00069
00070 GnomeCanvasGroup *parent;
00071
00072 GnucashSheet *sheet;
00073
00074
00075 GtkWidget *editor;
00076
00077 gchar *clipboard;
00078
00079 gboolean has_selection;
00080
00081 gboolean is_popup;
00082 gboolean show_popup;
00083
00084 PopupToggle popup_toggle;
00085
00086 GnomeCanvasItem *popup_item;
00087 GetPopupHeight get_popup_height;
00088 PopupAutosize popup_autosize;
00089 PopupSetFocus popup_set_focus;
00090 PopupPostShow popup_post_show;
00091 PopupGetWidth popup_get_width;
00092 gpointer popup_user_data;
00093
00094 GdkGC *gc;
00095
00096 gboolean reset_pos;
00097 gint x_offset;
00098 gint anchor_pos;
00099
00100
00101 VirtualLocation virt_loc;
00102
00103 SheetBlockStyle *style;
00104 } GncItemEdit;
00105
00106 typedef struct {
00107 GnomeCanvasItemClass parent_class;
00108 } GncItemEditClass;
00109
00110
00111 GType gnc_item_edit_get_type (void);
00112
00113 void gnc_item_edit_configure (GncItemEdit *item_edit);
00114
00115 void gnc_item_edit_get_pixel_coords (GncItemEdit *item_edit,
00116 int *x, int *y,
00117 int *w, int *h);
00118
00119 GnomeCanvasItem *gnc_item_edit_new (GnomeCanvasGroup *parent,
00120 GnucashSheet *sheet, GtkWidget *entry);
00121
00122 GncItemList * gnc_item_edit_new_list (GncItemEdit *item_edit, GtkListStore *shared_store);
00123 GNCDatePicker * gnc_item_edit_new_date_picker (GncItemEdit *item_edit);
00124
00125 void gnc_item_edit_set_popup (GncItemEdit *item_edit,
00126 GnomeCanvasItem *popup_item,
00127 GetPopupHeight get_popup_height,
00128 PopupAutosize popup_autosize,
00129 PopupSetFocus popup_set_focus,
00130 PopupPostShow popup_post_show,
00131 PopupGetWidth popup_get_width,
00132 gpointer popup_user_data);
00133
00134 void gnc_item_edit_show_popup (GncItemEdit *item_edit);
00135 void gnc_item_edit_hide_popup (GncItemEdit *item_edit);
00136
00137 int gnc_item_edit_get_toggle_offset (int row_height);
00138
00139 gboolean gnc_item_edit_set_cursor_pos (GncItemEdit *item_edit,
00140 VirtualLocation virt_loc, int x,
00141 gboolean changed_cells,
00142 gboolean extend_selection);
00143
00144 void gnc_item_edit_redraw (GncItemEdit *item_edit);
00145
00146 void gnc_item_edit_cut_clipboard (GncItemEdit *item_edit, guint32 time);
00147 void gnc_item_edit_copy_clipboard (GncItemEdit *item_edit, guint32 time);
00148 void gnc_item_edit_paste_clipboard (GncItemEdit *item_edit, guint32 time);
00149 void gnc_item_edit_paste_primary (GncItemEdit *item_edit, guint32 time);
00150
00151 void gnc_item_edit_set_has_selection (GncItemEdit *item_edit, gboolean has_selection);
00152 gboolean gnc_item_edit_get_has_selection (GncItemEdit *item_edit);
00153
00154 gboolean gnc_item_edit_selection_clear (GncItemEdit *item_edit,
00155 GdkEventSelection *event);
00156
00157 void gnc_item_edit_selection_get (GncItemEdit *item_edit,
00158 GtkSelectionData *selection_data,
00159 guint info,
00160 guint time);
00161
00162 void gnc_item_edit_selection_received (GncItemEdit *item_edit,
00163 GtkSelectionData *selection_data,
00164 guint time);
00165
00166 void gnc_item_edit_focus_in (GncItemEdit *item_edit);
00167 void gnc_item_edit_focus_out (GncItemEdit *item_edit);
00168
00169 void gnc_item_edit_reset_offset (GncItemEdit *item_edit);
00170
00171 #endif
00172
00173
00174
00175
00176
00177
00178