Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:hig:panel-plugins [2012/05/08 21:25] – [Monitor] landrydev:hig:panel-plugins [2012/06/14 15:06] (current) – [Size] landry
Line 19: Line 19:
 ===== General ===== ===== General =====
  
 +==== Tooltip ====
 +
 +If displaying a value in a tooltip, prefer the GtkTooltip API in favor of the GtkTooltips deprecated API. Using [[http://developer.gnome.org/gtk/2.24/GtkWidget.html#gtk-widget-set-tooltip-text|''gtk_widget_set_tooltip_text()'']] should be enought in most cases. If you need to update the tooltip more often than every 500ms (gtk default) you might need to set ''gtk-tooltip-timeout'' property on a ''GtkSettings'' instance.
 +
 +<code>
 + GtkSettings *settings;
 + settings = gtk_settings_get_default();
 + if (g_object_class_find_property(G_OBJECT_GET_CLASS(settings), "gtk-tooltip-timeout"))
 +   g_object_set(settings, "gtk-tooltip-timeout", update-interval - 10, NULL);
 +</code>
 ==== Context Menu ==== ==== Context Menu ====
  
Line 53: Line 63:
  
 The button has to display the image at the left or at the top given the panel's orientation. The button has to display the image at the left or at the top given the panel's orientation.
 +
 +==== Labels ====
 +
 +Labels should be oriented horizontally in the horizontal and deskbar mode and vertically (rotated clockwise) in the vertical mode.
 +
 +(RFC) For consistency with other panel plugins and for good aligning of plugins in the panel, I'd suggest aligning all labels to the left edge of the plugin, or icon, if present. Currently many plugins center their labels, which looks poorly in the deskbar mode, or if multiple rows are used in other modes.
 +
 +If plugin displays multiple rows of labels, it should preserve their native spacing (e.g. vbox with labels should be wrapped with a GtkAdjustment widget to prevent expanding the box).
 +
 +If multiple labels don't fit in the panel row, then either some of them should be hidden/rearranged, or "small" property should be disabled.
 +
 +==== Images or Icons ====
 +
 +If the plugin displays an icon-sized image, it should be aligned with the left edge (or top edge in the vertical mode) of the plugin. The size of the icon should match the size of icons embedded in buttons (launchers etc.). If all image sizes are same, the user may be able to set the size of the plugin in such a way that the images are not resized (resizing leads to smoothing the icon).
  
 ==== Input ==== ==== Input ====
Line 70: Line 94:
 The different elements are contained inside a box, the border width of the box is 0, and the spacing between the children is 2 pixels.  For the comments about the labels refer to the button class. The different elements are contained inside a box, the border width of the box is 0, and the spacing between the children is 2 pixels.  For the comments about the labels refer to the button class.
  
 +Some comments on the above design:
 +  * IMHO it would be better to flush all labels to the left (align them with the icon) and to stop them expand vertically.
 +  * It would be really nice to get rid of the progress bars.  What if we could replace all the progress bars with custom indicators drawn on top of the icon itself?
 +    * They will never be properly aligned across rows (we could try putting them between the icon and the labels but what if there is no icon?). 
 +    * It would be nice to use the above design in the deskbar mode as well, but currently if the number of rows is 1, labels and progress bars wouldn'd fit next to the icon.
 +    * It would be nice if the monitor plugin could display only an icon and still be useful (have the gauge displayed on it) - not too different from the mixer plugin.
 +
 +The above would result in the following layout (mockup):
 +
 +{{http://img837.imageshack.us/img837/2050/horizontal.png}}
 +
 +In a horizontal panel.
 +
 +{{http://img85.imageshack.us/img85/9162/deskbar.png}}
 +
 +In a deskbar.
 +
 +Note that the icons/labels are aligned wrt. each other, and that the monitor is still usable even if only icon is displayed.
 ===== Panel properties ===== ===== Panel properties =====
  
-==== mode ====+==== Mode ==== 
 + 
 +The panel has three modes: horizontal, vertical, and deskbar. 
 + 
 +=== Horizontal mode === 
 +  * Widgets are placed horizontally 
 +  * Progressbars are placed vertically 
 + 
 +=== Vertical mode === 
 +  * Widgets are placed vertically 
 +  * Labels are rotated to 90 degrees 
 +  * Progressbars are placed horizontally 
 + 
 +=== Deskbar mode === 
 +  * Widgets are placed vertically 
 +  * Composited widgets can be packed horizontally 
 +  * Labels are not rotated 
 +  * Progressbars are placed horizontally 
 + 
 +==== Size ==== 
 + 
 +The panel can be made from 16px tall to 128px tall, multiplied by the amount of rows : that makes a lot of combinations to test when designing an UI for a plugin, and one should try to make its UI consistent and usable in most sizes. 
 + 
 +==== Widgets padding/size ==== 
 + 
 +Widgets padding/size is important for consistency :
  
-The panel (starting with 4.10has 3 modes : horizontal, vertical and deskbarA plugin should layout its widgets following those rules : +  * Plugins have to set their container border width with ''gtk_container_set_border_width()'' to 1px for a panel size < 26px and 2px otherwise. Adjust it in the ''size-changed'' callback, which is called anyway in the panel creation
-  * use vertical XfceHVBox if the panel is in vertical or deskbar modehorizontal otherwise. +  * When displaying frame around the pluginthe border has to be 0px for a size of < 26px and 1px otherwise. 
-  * labels should be oriented vertically (using ''gtk_label_set_angle()''in vertical mode+  * Plugins can set a default spacing between children in the container via the //spacing// parameter to ''xfce_hvbox_new()'' 
-  * progressbars should be oriented vertically in horizontal modehorizontally otherwise.+  * Labels should be packed (via ''gtk_box_pack_start()'' or ''gtk_container_add()'') with a 2px padding
 +  * Progressbars, images and buttons should be packed with a 0px padding 
 +  * Progressbars should be 8px wide (when vertical, 8px tall when horizontal)use -1 for the other size to let the parent widget set the size.
  
-==== size ==== +==== event box ==== 
-plugins should be tested to still render fine in all panel sizes, starting from 16px to 40px at least.+If the plugin has an eventbox (to receive clicks or such), it should be made invisible to avoid problems with transparent/coloured panels. It should also be above its childs to actually receive events. 
 +<code> 
 +gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE); 
 +gtk_event_box_set_above_child(GTK_EVENT_BOX(ebox), TRUE); 
 +</code>
 ==== number of rows ==== ==== number of rows ====