RE: [gtk-list] Re: CList button selections




	This isn't too off to what I did in my copy of gtkclist.[ch] for
version 1.0.6

	/* what button may make a selection */
	enum
	{
	  CLIST_SELECT_NONE      = 0,
	  CLIST_SELECT_LEFT      = 1 << 0,
	  CLIST_SELECT_MIDDLE    = 1 << 1,
	  CLIST_SELECT_RIGHT     = 1 << 2,
	  CLIST_SELECT_ANY       = 07
	};

	/* set the button selection policy for what button may make
selections */
	void gtk_clist_set_button_selection (GtkCList * clist,
	                                     gint button_selection);
	/* button_selection may be or'ed with any of the enum selections */

	/* get the button selection policy for what button may make
selections */
	gint gtk_clist_get_button_selection (GtkCList * clist);

	I then added  in the GtkClist struct:

	 /* this could also be defaulted to CLIST_SELECT_LEFT */
	  clist->button_selection = CLIST_SELECT_ANY;  

	And in the gtk_clist_button_pressed :

	  /* selections on the list */
	  if (event->window == clist->clist_window)
	    {
	      /*
	       * Only select if the button pressed is defined to
	       *  activate a toggle.
	       */
	      if ((event->button) &&
	          ((1 << (event->button - 1)) &
	           (clist->button_selection) &
	           CLIST_SELECT_ANY))
	        {
	          x = event->x;
	          y = event->y;

	          if (get_selection_info (clist, x, y, &row, &column))
	            toggle_row (clist, row, column, event);
	        } /* endif button may toggle */

	      return FALSE;
	    }

	I set what button does the selection, but I like your idea
	of setting what actions each button does. I don't think that would
	be too much of a task, and could prove useful later.
	I'm still working with 1.0.6, but I'm willing to take a look at
	1.1.x (if it is somewhat stabe, I'm still trying to get work done :)


> hm, i think that would be overkill configuration wise ;)
> 
> maybe GtkCList should provide a sophisticated interface for this, ala
> 
> typedef enum
> {
>   GTK_BUTTON_IGNORED    = 0,
>   GTK_BUTTON_SELECTS    = 1 << 0,
>   GTK_BUTTON_UNSELECTS  = 1 << 1,
>   GTK_BUTTON_DRAGS      = 1 << 2,
>   ...
> } GtkButtonFlags;
> 
> 
> gtk_clist_set_button_actions (GtkCList            *clist,
>                               GtkButtonActionType  button1_actions,
>                               GtkButtonActionType  button2_actions,
>                               GtkButtonActionType  button3_actions);
> 
> 
> just an idea... ;)
> 
> > 
> > bye,
> >   Lars
> > 
> > -- 
> > To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com <
> /dev/null
> > 
> > 
> 
> ---
> ciaoTJ
> 
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]