ergtklistview.h

Go to the documentation of this file.
00001 #ifndef __ERGTK_LIST_VIEW_H__
00002 #define __ERGTK_LIST_VIEW_H__
00003 
00004 /**
00005  * \file ergtklistview.h
00006  * \brief ereader gtk library - GtkTreeView object adapted for ereader system
00007  */
00008  
00009 /*
00010  * This file is part of libergtk.
00011  *
00012  * libergtk is free software: you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation, either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * libergtk is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00024  */
00025  
00026 /**
00027  * Copyright (C) 2008 iRex Technologies B.V.
00028  * All rights reserved.
00029  */
00030  
00031 G_BEGIN_DECLS
00032 
00033 #ifdef ENABLE_NLS
00034 #define P_(String) dgettext(GETTEXT_PACKAGE "-properties",String)
00035 #else 
00036 #define P_(String) (String)
00037 #endif
00038 
00039 /* not really I18N-related, but also a string marker macro */
00040 #define I_(string) g_intern_static_string (string)
00041 
00042 
00043 #define ERGTK_TYPE_LIST_VIEW                (ergtk_list_view_get_type())
00044 #define ERGTK_LIST_VIEW(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), ERGTK_TYPE_LIST_VIEW, erGtkListView))
00045 #define ERGTK_IS_LIST_VIEW(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), ERGTK_TYPE_LIST_VIEW))
00046 
00047 #define ERGTK_LIST_VIEW_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass),  ERGTK_TYPE_LIST_VIEW, erGtkListViewClass))
00048 #define ERGTK_LIST_VIEW_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj),  ERGTK_TYPE_LIST_VIEW, erGtkListViewClass))
00049 #define ERGTK_IS_LIST_VIEW_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE((klass),  ERGTK_TYPE_LIST_VIEW))
00050 
00051 typedef enum
00052 {
00053     ERGTK_LIST_VIEW_PRESS_SHORT_UP,
00054     ERGTK_LIST_VIEW_PRESS_SHORT_DOWN,
00055     ERGTK_LIST_VIEW_PRESS_LONG_UP,
00056     ERGTK_LIST_VIEW_PRESS_LONG_DOWN,
00057     ERGTK_LIST_VIEW_PRESS_ACTIVATE
00058 } erGtkListViewKeyPress;
00059 
00060 typedef struct _erGtkListView      erGtkListView;
00061 typedef struct _erGtkListViewClass erGtkListViewClass;
00062 
00063 struct _erGtkListView
00064 {
00065     GtkTreeView         parent;         // parent class
00066     
00067     // private
00068     //   fixed height for each row
00069     gint                row_height;
00070     gboolean            is_forced_height;
00071     //   button-press info
00072     gboolean            is_button_down;
00073     guint               press_event_button;
00074     gint                press_event_state;
00075     gint                press_event_x;
00076     gint                press_event_y;
00077     gint                press_item_idx;
00078 };
00079 
00080 struct _erGtkListViewClass
00081 {
00082     GtkTreeViewClass parent_class;
00083 
00084     // virtual methods
00085 
00086     // signal handlers
00087     gboolean (*pre_move_cursor) ( erGtkListView         *list_view,
00088                                   erGtkListViewKeyPress navigate   );
00089 };
00090 
00091 
00092 // public functions
00093 GtkWidget       *ergtk_list_view_new                    ( void );
00094 
00095 GtkWidget       *ergtk_list_view_new_with_model         ( GtkTreeModel          *model );
00096 
00097 gint            ergtk_list_view_append_column           ( erGtkListView         *er_listview,
00098                                                           GtkTreeViewColumn     *column      );
00099 
00100 void            ergtk_list_view_get_view_size           ( erGtkListView         *er_listview, 
00101                                                           gint                  *num_rows, 
00102                                                           gint                  *num_items   );
00103 
00104 void            ergtk_list_view_get_cursor              ( erGtkListView         *er_listview, 
00105                                                                                  gint *row   );
00106 
00107 void            ergtk_list_view_set_cursor              ( erGtkListView         *er_listview, 
00108                                                           gint                  row          ); 
00109 
00110 void            ergtk_list_view_set_focus_mode          ( erGtkListView         *er_listview, 
00111                                                           gboolean              focus_in,
00112                                                           gboolean              focus_out    );
00113 
00114 void            ergtk_list_view_set_row_height          ( erGtkListView         *er_listview,
00115                                                           gint                  row_height   );
00116 
00117 
00118 /**
00119  * get type of erGtkListView widget
00120  *
00121  * @returns type
00122  */
00123 GType ergtk_list_view_get_type(void);
00124 
00125 
00126 G_END_DECLS
00127 
00128 #endif  // __ERGTK_LIST_VIEW_H__
Generated by  doxygen 1.6.2-20100208