GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-cell-renderer-popup.h
1 /*************************************************************************
2  * The following code has come from Planner. This code implements a
3  * GtkCalendar in a custom GtkCellEditable popup from GtkCellRenderer.
4  *
5  * These files have been renamed and changed to remove code not required
6  * and to remove a dependency on libplanner.
7  *
8  * Copyright (C) 2012 Robert Fewell
9  *
10  * Copyright (C) 2001-2002 CodeFactory AB
11  * Copyright (C) 2001-2002 Richard Hult <[email protected]>
12  * Copyright (C) 2001-2002 Mikael Hallendal <[email protected]>
13  *
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License as
16  * published by the Free Software Foundation; either version 2 of the
17  * License, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  * General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public
25  * License along with this program; if not, write to the
26  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27  * Boston, MA 02111-1307, USA.
28  *************************************************************************/
29 
30 #ifndef __GNC_CELL_RENDERER_POPUP_H__
31 #define __GNC_CELL_RENDERER_POPUP_H__
32 
33 #include <pango/pango.h>
34 #include <gtk/gtkcellrenderertext.h>
35 
36 #define GNC_TYPE_CELL_RENDERER_POPUP (gnc_cell_renderer_popup_get_type ())
37 #define GNC_CELL_RENDERER_POPUP(obj) (GTK_CHECK_CAST ((obj), GNC_TYPE_CELL_RENDERER_POPUP, GncCellRendererPopup))
38 #define GNC_CELL_RENDERER_POPUP_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNC_TYPE_CELL_RENDERER_POPUP, GncCellRendererPopupClass))
39 #define GNC_IS_CELL_RENDERER_POPUP(obj) (GTK_CHECK_TYPE ((obj), GNC_TYPE_CELL_RENDERER_POPUP))
40 #define GNC_IS_CELL_RENDERER_POPUP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GNC_TYPE_CELL_RENDERER_POPUP))
41 #define GNC_CELL_RENDERER_POPUP_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GNC_TYPE_CELL_RENDERER_POPUP, GncCellRendererPopupClass))
42 
45 
47 {
48  GtkCellRendererText parent;
49 
50  /* Cached width of the popup button. */
51  gint button_width;
52 
53  /* The popup window. */
54  GtkWidget *popup_window;
55 
56  /* The widget that should grab focus on popup. */
57  GtkWidget *focus_window;
58 
59  /* The editable entry. */
60  GtkWidget *editable;
61 
62  gboolean shown;
63  gboolean editing_canceled;
64  gchar *cell_text;
65 };
66 
68 {
69  GtkCellRendererTextClass parent_class;
70 
71  void (* show_popup) (GncCellRendererPopup *cell,
72  const gchar *path,
73  gint x1,
74  gint y1,
75  gint x2,
76  gint y2);
77 
78  void (* hide_popup) (GncCellRendererPopup *cell);
79 };
80 
81 GtkType gnc_cell_renderer_popup_get_type (void) G_GNUC_CONST;
82 
83 GtkCellRenderer *gnc_cell_renderer_popup_new (void);
84 
85 void gnc_cell_renderer_popup_show (GncCellRendererPopup *cell,
86  const gchar *path,
87  gint x1,
88  gint y1,
89  gint x2,
90  gint y2);
91 
92 void gnc_cell_renderer_popup_hide (GncCellRendererPopup *cell);
93 
94 #endif /* __GNC_CELL_RENDERER_POPUP_H__ */