Logo Search packages:      
Sourcecode: dcgui version File versions  Download package

macro.h

/* dc_gui2 - a GTK+2 GUI for DCTC
 * Copyright (C) 2002 Eric Prevoteau
 *
 * macro.h: Copyright (C) Eric Prevoteau <www@a2pb.gotdns.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
/*
$Id: macro.h,v 1.5 2003/12/28 09:29:32 uid68112 Exp $
*/

#ifndef __MACRO_H__
#define __MACRO_H__

/*********************************************************************************************************/
/* same as gtk_tree_view_insert_column_with_attributes but the created column is resizable and clickable */
/*********************************************************************************************************/
#define MY_RS_gtk_tree_view_insert_column_with_attributes(view,num_col,attributes...)     \
      {                                                                                                                                                                 \
            GtkTreeViewColumn *MYcol;                                                                                                           \
            MYcol=gtk_tree_view_column_new_with_attributes(attributes);                                     \
            gtk_tree_view_column_set_resizable(MYcol,TRUE);                                                             \
            gtk_tree_view_column_set_sizing(MYcol,GTK_TREE_VIEW_COLUMN_FIXED);                        \
            gtk_tree_view_column_set_sort_column_id(MYcol,num_col);                                               \
            gtk_tree_view_insert_column(view,MYcol,num_col);                                                            \
      }

/*********************************************************************************************************/
/* same as gtk_tree_view_insert_column_with_attributes but the created column is resizable and clickable */
/* and a custom cell_data_func and sort_func are provided.                                               */
/*********************************************************************************************************/
#define MY_RSCD_gtk_tree_view_insert_column_with_attributes(model,view,num_col,data_func,sort_func,title,render,attributes...)      \
      {                                                                                                                                                                 \
            GtkTreeViewColumn *MYcol;                                                                                                           \
            MYcol=gtk_tree_view_column_new_with_attributes(title,render,attributes);            \
            gtk_tree_view_column_set_resizable(MYcol,TRUE);                                                             \
            gtk_tree_view_column_set_cell_data_func(MYcol,render,data_func,GINT_TO_POINTER(num_col),NULL); \
            gtk_tree_view_insert_column(view,MYcol,num_col);                                                            \
            gtk_tree_view_column_set_sort_column_id(MYcol,num_col);                                               \
            gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model),num_col,sort_func,GINT_TO_POINTER(num_col),NULL); \
      }

/*********************************************************************************************************/
/* same as gtk_tree_view_insert_column_with_attributes but the created column is resizable and clickable */
/* and a custom cell_data_func and sort_func are provided. Column is not in autoresize mode              */
/* Note: autoresize and visible property conflicts. If autoresize=COLUMN_FIXED, when a column becomes    */
/*       visible, its size remains 0 (=> not visible)                                                    */
/*********************************************************************************************************/
#define MY_RSCD2_gtk_tree_view_insert_column_with_attributes(model,view,num_col,data_func,sort_func,title,render,attributes...)     \
      {                                                                                                                                                                 \
            GtkTreeViewColumn *MYcol;                                                                                                           \
            MYcol=gtk_tree_view_column_new_with_attributes(title,render,attributes);            \
            gtk_tree_view_column_set_resizable(MYcol,TRUE);                                                             \
            gtk_tree_view_column_set_sizing(MYcol,GTK_TREE_VIEW_COLUMN_FIXED);                        \
            gtk_tree_view_column_set_cell_data_func(MYcol,render,data_func,GINT_TO_POINTER(num_col),NULL); \
            gtk_tree_view_insert_column(view,MYcol,num_col);                                                            \
            gtk_tree_view_column_set_sort_column_id(MYcol,num_col);                                               \
            gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model),num_col,sort_func,GINT_TO_POINTER(num_col),NULL); \
      }

/****************************************************************************************************************/
/* same as gtk_tree_view_insert_column_with_attributes except but the created column is resizable and clickable */
/* the column is inserted at the position num_col and sorted on num_sort_col                                    */
/****************************************************************************************************************/
#define MY_RS2_gtk_tree_view_insert_column_with_attributes(view,num_col,num_sort_col,attributes...)   \
      {                                                                                                                                                                 \
            GtkTreeViewColumn *MYcol;                                                                                                           \
            MYcol=gtk_tree_view_column_new_with_attributes(attributes);                                     \
            gtk_tree_view_column_set_resizable(MYcol,TRUE);                                                             \
            gtk_tree_view_column_set_sizing(MYcol,GTK_TREE_VIEW_COLUMN_FIXED);                        \
            gtk_tree_view_column_set_sort_column_id(MYcol,num_sort_col);                                    \
            gtk_tree_view_insert_column(view,MYcol,num_col);                                                            \
      }

/**************************************************************************************************/
/* same as gtk_tree_view_insert_column_with_attributes except but the created column is clickable */
/**************************************************************************************************/
#define MY_gtk_tree_view_insert_column_with_attributes(view,num_col,attributes...)  \
      {                                                                                                                                                                 \
            GtkTreeViewColumn *MYcol;                                                                                                           \
            MYcol=gtk_tree_view_column_new_with_attributes(attributes);                                     \
            gtk_tree_view_column_set_sort_column_id(MYcol,num_col);                                               \
            gtk_tree_view_insert_column(view,MYcol,num_col);                                                            \
      }

/****************************************************************************************************************/
/* same as gtk_tree_view_insert_column_with_attributes except but the created column is resizable and clickable */
/* a user fnc and a user parameter are called when the column is clicked.                                       */
/****************************************************************************************************************/
#define MY_RS_CK_gtk_tree_view_insert_column_with_attributes(view,user_fnc,num_col,attributes...)     \
      {                                                                                                                                                                 \
            GtkTreeViewColumn *MYcol;                                                                                                           \
            MYcol=gtk_tree_view_column_new_with_attributes(attributes);                                     \
            gtk_tree_view_column_set_resizable(MYcol,TRUE);                                                             \
            gtk_tree_view_column_set_sizing(MYcol,GTK_TREE_VIEW_COLUMN_FIXED);                        \
            gtk_tree_view_column_set_sort_column_id(MYcol,num_col);                                               \
            gtk_tree_view_insert_column(view,MYcol,num_col);                                                            \
            g_signal_connect((gpointer)MYcol,"clicked",G_CALLBACK(user_fnc),GINT_TO_POINTER(num_col));\
      }


#endif

Generated by  Doxygen 1.6.0   Back to index