Back to index

im-sdk  12.3.91
imlabel.h
Go to the documentation of this file.
00001 /* GTK - The GIMP Toolkit
00002  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free
00016  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00018 
00019 /*
00020  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
00021  * file for a list of people on the GTK+ Team.  See the ChangeLog
00022  * files for a list of changes.  These files are distributed with
00023  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
00024  */
00025 
00026 /******************************************************
00027 *Imported from gtk+-2.0 source by phill.zhang@sun.com
00028 ******************************************************/
00029 
00030 #ifndef __IM_LABEL_H__
00031 #define __IM_LABEL_H__
00032 
00033 #include <gdk/gdk.h>
00034 #include <gtk/gtkmisc.h>
00035 #include <gtk/gtkwindow.h>
00036 #include <gtk/gtkmenu.h>
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif /* __cplusplus */
00041 
00042 
00043 #define IM_TYPE_LABEL                (im_label_get_type ())
00044 #define IM_LABEL(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), IM_TYPE_LABEL, ImLabel))
00045 #define IM_LABEL_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), IM_TYPE_LABEL, ImLabelClass))
00046 #define IM_IS_LABEL(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IM_TYPE_LABEL))
00047 #define IM_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IM_TYPE_LABEL))
00048 #define IM_LABEL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), IM_TYPE_LABEL, ImLabelClass))
00049 
00050 
00051 typedef struct _ImLabel       ImLabel;
00052 typedef struct _ImLabelClass  ImLabelClass;
00053 
00054 typedef struct _ImLabelSelectionInfo ImLabelSelectionInfo;
00055 
00056 struct _ImLabel
00057 {
00058   GtkMisc misc;
00059 
00060   /*< private >*/
00061   gchar  *label;
00062   guint   jtype : 2;
00063   //guint   wrap : 1;
00064   //guint   use_underline : 1;
00065   guint   use_markup : 1;
00066 
00067   //guint   mnemonic_keyval;
00068 
00069   gchar  *text;
00070   PangoAttrList *attrs;
00071   PangoAttrList *effective_attrs;
00072   PangoLayout *layout;
00073   ImLabelSelectionInfo *select_info;
00074   gint    caret_index, showing_caret, delay_hide_caret, timer_id;
00075 
00076   //GtkWidget *mnemonic_widget;
00077   //GtkWindow *mnemonic_window;
00078 
00079 };
00080 
00081 struct _ImLabelClass
00082 {
00083   GtkMiscClass parent_class;
00084 
00085   /* Padding for future expansion */
00086   void (*_gtk_reserved1) (void);
00087   void (*_gtk_reserved2) (void);
00088   void (*_gtk_reserved3) (void);
00089   void (*_gtk_reserved4) (void);
00090   void (*_gtk_reserved5) (void);
00091   void (*_gtk_reserved6) (void);
00092   void (*_gtk_reserved7) (void);
00093 };
00094 
00095 GType                 im_label_get_type          (void) G_GNUC_CONST;
00096 GtkWidget*            im_label_new               (const char    *str);
00097 void                  im_label_set_text          (ImLabel      *label,
00098                                                    const char    *str);
00099 G_CONST_RETURN gchar* im_label_get_text          (ImLabel      *label);
00100 
00101 void                  im_label_set_attributes    (ImLabel      *label,
00102                                                    PangoAttrList *attrs);
00103 PangoAttrList        *im_label_get_attributes    (ImLabel      *label);
00104 
00105 void                  im_label_set_label         (ImLabel      *label,
00106                                                    const gchar   *str);
00107 G_CONST_RETURN gchar *im_label_get_label         (ImLabel      *label);
00108 void                  im_label_set_markup        (ImLabel      *label,
00109                                                    const gchar   *str);
00110 void                  im_label_set_use_markup    (ImLabel      *label,
00111                                                    gboolean       setting);
00112 gboolean              im_label_get_use_markup    (ImLabel      *label);
00113 void                  im_label_set_justify       (ImLabel         *label,
00114                                                   GtkJustification  jtype);
00115 GtkJustification      im_label_get_justify       (ImLabel         *label);
00116 void                  im_label_set_pattern       (ImLabel         *label,
00117                                                   const gchar      *pattern);
00118 void                  im_label_set_selectable    (ImLabel         *label,
00119                                                   gboolean          setting);
00120 gboolean              im_label_get_selectable    (ImLabel         *label);
00121 void                  im_label_select_region     (ImLabel         *label,
00122                                                    gint              start_offset,
00123                                                    gint              end_offset);
00124 gboolean              im_label_get_selection_bounds(ImLabel         *label,
00125                                                    gint             *start,
00126                                                    gint             *end);
00127 
00128 gint                im_label_get_text_length   (ImLabel* label);
00129 void                  im_label_set_caret_index   (ImLabel *label, gint caret);
00130 //gint                  im_label_get_caret_index   (ImLabel *label);
00131 
00132 PangoLayout *         im_label_get_layout         (ImLabel *label);
00133 void                  im_label_get_layout_offsets (ImLabel *label,
00134                                                    gint     *x,
00135                                                    gint     *y);
00136 
00137 void                  im_label_get_caret_rect     (ImLabel *label,
00138                                                    int idx, int*px, int*py, int*pw, int*ph);
00139 
00140 
00141 #ifdef __cplusplus
00142 }
00143 #endif /* __cplusplus */
00144 
00145 
00146 #endif /* __IM_LABEL_H__ */