Re: i would like to make a sidebar widget from the Paned gtk objects



Something like Nautilus Side Pane?

the code is in:
....../nautilus/libnautilus-private/nautilus-horizontal-splitter.c

It's a widget that inherits from GtkHPaned



El jue, 13-02-2003 a las 18:12, Charles Lambert escribió:
> hello,
> i'm new here, hope i'm doing this right. I want to
> create a sidebar widget similar to that in mozilla.
> this can be accomplished with the VPaned and HPaned
> gtk+ widgets. the code i have that accomplishes this
> for a left sidebar is a callback connected to the
> HPaned object with ...
> 
> g_signal_connect (G_OBJECT (left_sidebar),
> "button-press-event",
> 		    G_CALLBACK (toggle_left_sidebar), NULL );
> 
> ... and implemented in the code below ...
> 
> /** @brief Gtk callback that toggles the left sidebar
> to hide or show it
>  * @param widget GtkWidget * - the left_sidebar widget
> to manipulate
>  * @param event GdkEventButton * - used to process the
> right (mouse 3) button
>  *        click
>  * @param data gpointer - not used in this function,
> required for callback
>  *        function format
>  * @return gboolean - returns TRUE to stop propogation
> if the right mouse
>  *          button is pressed. Returns FALSE otherwise
> so that other handlers
>  *          can recieve this event
>  * @todo has static variable unhid_pos
>  */
> static gboolean
> toggle_left_sidebar (GtkWidget *widget,
> 		     GdkEventButton *event,
> 		     gpointer data )
> {
>   static gint unhid_pos;
> 
>   if (event->button == RIGHT_MOUSE_BUTTON) {
>     if (get_left_sidebar_hidden()) {
>       gtk_paned_set_position (GTK_PANED (widget),
> unhid_pos);
>       set_left_sidebar_hidden(FALSE);
>     } else {
>       unhid_pos = gtk_paned_get_position (GTK_PANED
> (widget));
>       gtk_paned_set_position (GTK_PANED (widget), 0);
>       set_left_sidebar_hidden (TRUE);
>     }
>     return TRUE;
>   }
>   return FALSE;
> }
> 
> ... i also have code for a right side bar implemented
> as follows it is different from the above ...
> 
> /** @brief callback to toggle hiding or showing the
> right sidebar
>  *         on a right (mouse3) click
>  * @param widget the sidebar widget
>  * @param event the mouse press event
>  * @param data not used, here for compliant gtk
> callback function
>  * @todo has static variable unhid_pos
>  */
> static gboolean
> toggle_right_sidebar (GtkWidget *widget,
> 		      GdkEventButton *event,
> 		      gpointer data )
> {
>   static gint unhid_pos;
> 
>   if (event->button == RIGHT_MOUSE_BUTTON) {
>     if (get_right_sidebar_hidden()) {
>       gtk_paned_set_position (GTK_PANED (widget),
> (((widget->allocation.width) - unhid_pos) * -1));
>       set_right_sidebar_hidden(FALSE);
>     } else {
>       unhid_pos = (widget->allocation.width) -
> (gtk_paned_get_position (GTK_PANED (widget)) * -1);
>       gtk_paned_set_position (GTK_PANED (widget),
> widget->allocation.width);
>       set_right_sidebar_hidden (TRUE);
>     }
>     return TRUE;
>   }
>   return FALSE;
> }
> 
> ... i would like to implement this directly into the
> Paned ojbects as opposed to new widgets, i would like
> input on it. and if anyone is already developing
> something like this let me know so i'm not duplicating
> work.
> 
> Thanks,
> Charles W. Lambert
> email: cwlambert76 yahoo com
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list
-- 
Jaime Serrano <jaiserca inf upv es>




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