Back to index

lightning-sunbird  0.9+nobinonly
gtkdrawing.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2002
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *  Brian Ryner <bryner@brianryner.com>  (Original Author)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00048 #ifndef _GTK_DRAWING_H_
00049 #define _GTK_DRAWING_H_
00050 
00051 #include <gdk/gdk.h>
00052 #include <gtk/gtkstyle.h>
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif /* __cplusplus */
00057 
00058 /*** type definitions ***/
00059 typedef struct {
00060   guint8 active;
00061   guint8 focused;
00062   guint8 inHover;
00063   guint8 disabled;
00064   guint8 isDefault;
00065   guint8 canDefault;
00066   gint32 curpos; /* curpos and maxpos are used for scrollbars */
00067   gint32 maxpos;
00068 } GtkWidgetState;
00069 
00070 typedef struct {
00071   gint slider_width;
00072   gint trough_border;
00073   gint stepper_size;
00074   gint stepper_spacing;
00075   gint min_slider_size;
00076 } MozGtkScrollbarMetrics;
00077 
00079 typedef enum {
00080   /* the first tab in the group */
00081   MOZ_GTK_TAB_FIRST           = 1 << 0,
00082   /* the tab just before the selected tab */
00083   MOZ_GTK_TAB_BEFORE_SELECTED = 1 << 1,
00084   /* the selected tab */
00085   MOZ_GTK_TAB_SELECTED        = 1 << 2
00086 } GtkTabFlags;
00087 
00088 /* function type for moz_gtk_enable_style_props */
00089 typedef gint (*style_prop_t)(GtkStyle*, const gchar*, gint);
00090 
00091 /*** result/error codes ***/
00092 #define MOZ_GTK_SUCCESS 0
00093 #define MOZ_GTK_UNKNOWN_WIDGET -1
00094 #define MOZ_GTK_UNSAFE_THEME -2
00095 
00096 /*** widget type constants ***/
00097 typedef enum {
00098   /* Paints a GtkButton. flags is a GtkReliefStyle. */
00099   MOZ_GTK_BUTTON,
00100   /* Paints a GtkCheckButton. flags is a boolean, 1=checked, 0=not checked. */
00101   MOZ_GTK_CHECKBUTTON,
00102   /* Paints a GtkRadioButton. flags is a boolean, 1=checked, 0=not checked. */
00103   MOZ_GTK_RADIOBUTTON,
00108   MOZ_GTK_SCROLLBAR_BUTTON,
00109   /* Paints the trough (track) of a GtkScrollbar. */
00110   MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL,
00111   MOZ_GTK_SCROLLBAR_TRACK_VERTICAL,
00112   /* Paints the slider (thumb) of a GtkScrollbar. */
00113   MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL,
00114   MOZ_GTK_SCROLLBAR_THUMB_VERTICAL,
00115   /* Paints the gripper of a GtkHandleBox. */
00116   MOZ_GTK_GRIPPER,
00117   /* Paints a GtkEntry. */
00118   MOZ_GTK_ENTRY,
00119   /* Paints a GtkOptionMenu. */
00120   MOZ_GTK_DROPDOWN,
00121   /* Paints a dropdown arrow (a GtkButton containing a down GtkArrow). */
00122   MOZ_GTK_DROPDOWN_ARROW,
00123   /* Paints the container part of a GtkCheckButton. */
00124   MOZ_GTK_CHECKBUTTON_CONTAINER,
00125   /* Paints the container part of a GtkRadioButton. */
00126   MOZ_GTK_RADIOBUTTON_CONTAINER,
00127   /* Paints the label of a GtkCheckButton (focus outline) */
00128   MOZ_GTK_CHECKBUTTON_LABEL,
00129   /* Paints the label of a GtkRadioButton (focus outline) */
00130   MOZ_GTK_RADIOBUTTON_LABEL,
00131   /* Paints the background of a GtkHandleBox. */
00132   MOZ_GTK_TOOLBAR,
00133   /* Paints a GtkToolTip */
00134   MOZ_GTK_TOOLTIP,
00135   /* Paints a GtkFrame (e.g. a status bar panel). */
00136   MOZ_GTK_FRAME,
00137   /* Paints a GtkProgressBar. */
00138   MOZ_GTK_PROGRESSBAR,
00139   /* Paints a progress chunk of a GtkProgressBar. */
00140   MOZ_GTK_PROGRESS_CHUNK,
00141   /* Paints a tab of a GtkNotebook. flags is a GtkTabFlags, defined above. */
00142   MOZ_GTK_TAB,
00143   /* Paints the background and border of a GtkNotebook. */
00144   MOZ_GTK_TABPANELS,
00145   /* Paints the background of the menu bar. */
00146   MOZ_GTK_MENUBAR,
00147   /* Paints the background of menus, context menus. */
00148   MOZ_GTK_MENUPOPUP,
00149   /* Paints items of menubar and popups. */
00150   MOZ_GTK_MENUITEM,
00151   MOZ_GTK_CHECKMENUITEM,
00152   MOZ_GTK_RADIOMENUITEM,
00153   /* Paints the background of a window, dialog or page. */
00154   MOZ_GTK_WINDOW
00155 } GtkThemeWidgetType;
00156 
00157 /*** General library functions ***/
00165 gint moz_gtk_init();
00166 
00174 gint moz_gtk_enable_style_props(style_prop_t styleGetProp);
00175 
00182 gint moz_gtk_shutdown();
00183 
00184 
00185 /*** Widget drawing ***/
00194 gint
00195 moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable,
00196                      GdkRectangle* rect, GdkRectangle* cliprect,
00197                      GtkWidgetState* state, gint flags);
00198 
00199 
00200 /*** Widget metrics ***/
00208 gint moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* xthickness,
00209                                gint* ythickness);
00210 
00219 gint
00220 moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing);
00221 
00230 gint
00231 moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing);
00232 
00241 gint
00242 moz_gtk_button_get_focus(gboolean* interior_focus,
00243                          gint* focus_width, gint* focus_pad);
00244 gint
00245 moz_gtk_checkbox_get_focus(gboolean* interior_focus,
00246                            gint* focus_width, gint* focus_pad);
00247 gint
00248 moz_gtk_radio_get_focus(gboolean* interior_focus,
00249                         gint* focus_width, gint* focus_pad);
00250 
00257 gint
00258 moz_gtk_get_scrollbar_metrics(MozGtkScrollbarMetrics* metrics);
00259 
00267 gint moz_gtk_get_dropdown_arrow_size(gint* width, gint* height);
00268 
00269 #ifdef __cplusplus
00270 }
00271 #endif /* __cplusplus */
00272 
00273 #endif