]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkframe.c
Rename the variables for the color bitmap to have "color" in their name,
[~andy/gtk] / gtk / gtkframe.c
index eb02f9c8e28720ed764e0880b44ebe5a48a3e4cb..460a53db745a85dafc45693ace2b514af9053c87 100644 (file)
@@ -28,7 +28,9 @@
 #include <string.h>
 #include "gtkframe.h"
 #include "gtklabel.h"
+#include "gtkprivate.h"
 #include "gtkintl.h"
+#include "gtkalias.h"
 
 #define LABEL_PAD 1
 #define LABEL_SIDE_PAD 2
@@ -97,7 +99,7 @@ gtk_frame_get_type (void)
        (GInstanceInitFunc) gtk_frame_init,
       };
 
-      frame_type = g_type_register_static (GTK_TYPE_BIN, "GtkFrame",
+      frame_type = g_type_register_static (GTK_TYPE_BIN, I_("GtkFrame"),
                                           &frame_info, 0);
     }
 
@@ -126,51 +128,49 @@ gtk_frame_class_init (GtkFrameClass *class)
                                                         P_("Label"),
                                                         P_("Text of the frame's label"),
                                                         NULL,
-                                                        G_PARAM_READABLE |
-                                                       G_PARAM_WRITABLE));
+                                                        GTK_PARAM_READABLE |
+                                                       GTK_PARAM_WRITABLE));
   g_object_class_install_property (gobject_class,
                                   PROP_LABEL_XALIGN,
-                                  g_param_spec_float ("label_xalign",
+                                  g_param_spec_float ("label-xalign",
                                                       P_("Label xalign"),
                                                       P_("The horizontal alignment of the label"),
                                                       0.0,
                                                       1.0,
                                                       0.5,
-                                                      G_PARAM_READABLE |
-                                                      G_PARAM_WRITABLE));
+                                                      GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                   PROP_LABEL_YALIGN,
-                                  g_param_spec_float ("label_yalign",
+                                  g_param_spec_float ("label-yalign",
                                                       P_("Label yalign"),
                                                       P_("The vertical alignment of the label"),
                                                       0.0,
                                                       1.0,
                                                       0.5,
-                                                      G_PARAM_READABLE |
-                                                      G_PARAM_WRITABLE));
+                                                      GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                    PROP_SHADOW,
                                    g_param_spec_enum ("shadow", NULL,
                                                       P_("Deprecated property, use shadow_type instead"),
                                                      GTK_TYPE_SHADOW_TYPE,
                                                      GTK_SHADOW_ETCHED_IN,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                      GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                    PROP_SHADOW_TYPE,
-                                   g_param_spec_enum ("shadow_type",
+                                   g_param_spec_enum ("shadow-type",
                                                       P_("Frame shadow"),
                                                       P_("Appearance of the frame border"),
                                                      GTK_TYPE_SHADOW_TYPE,
                                                      GTK_SHADOW_ETCHED_IN,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                      GTK_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
                                    PROP_LABEL_WIDGET,
-                                   g_param_spec_object ("label_widget",
+                                   g_param_spec_object ("label-widget",
                                                         P_("Label widget"),
                                                         P_("A widget to display in place of the usual frame label"),
                                                         GTK_TYPE_WIDGET,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                        GTK_PARAM_READWRITE));
   
   widget_class->expose_event = gtk_frame_expose;
   widget_class->size_request = gtk_frame_size_request;
@@ -263,6 +263,15 @@ gtk_frame_get_property (GObject         *object,
     }
 }
 
+/**
+ * gtk_frame_new:
+ * @label: the text to use as the label of the frame
+ * 
+ * Creates a new #GtkFrame, with optional label @label.
+ * If @label is %NULL, the label is omitted.
+ * 
+ * Return value: a new #GtkFrame widget
+ **/
 GtkWidget*
 gtk_frame_new (const gchar *label)
 {
@@ -297,6 +306,14 @@ gtk_frame_forall (GtkContainer *container,
     (* callback) (frame->label_widget, callback_data);
 }
 
+/**
+ * gtk_frame_set_label:
+ * @frame: a #GtkFrame
+ * @label: the text to use as the label of the frame
+ * 
+ * Sets the text of the label. If @label is %NULL,
+ * the current label is removed.
+ **/
 void
 gtk_frame_set_label (GtkFrame *frame,
                     const gchar *label)
@@ -320,7 +337,7 @@ gtk_frame_set_label (GtkFrame *frame,
  * gtk_frame_get_label:
  * @frame: a #GtkFrame
  * 
- * If the frame's label widget is a #GtkLabel, return the
+ * If the frame's label widget is a #GtkLabel, returns the
  * text in the label widget. (The frame will have a #GtkLabel
  * for the label widget if a non-%NULL argument was passed
  * to gtk_frame_new().)
@@ -346,7 +363,7 @@ gtk_frame_get_label (GtkFrame *frame)
  * @frame: a #GtkFrame
  * @label_widget: the new label widget
  * 
- * Set the label widget for the frame. This is the widget that
+ * Sets the label widget for the frame. This is the widget that
  * will appear embedded in the top edge of the frame as a
  * title.
  **/
@@ -382,7 +399,7 @@ gtk_frame_set_label_widget (GtkFrame  *frame,
     gtk_widget_queue_resize (GTK_WIDGET (frame));
 
   g_object_freeze_notify (G_OBJECT (frame));
-  g_object_notify (G_OBJECT (frame), "label_widget");
+  g_object_notify (G_OBJECT (frame), "label-widget");
   g_object_notify (G_OBJECT (frame), "label");
   g_object_thaw_notify (G_OBJECT (frame));
 }
@@ -404,6 +421,18 @@ gtk_frame_get_label_widget (GtkFrame *frame)
   return frame->label_widget;
 }
 
+/**
+ * gtk_frame_set_label_align:
+ * @frame: a #GtkFrame
+ * @xalign: The position of the label along the top edge
+ *   of the widget. A value of 0.0 represents left alignment;
+ *   1.0 represents right alignment.
+ * @yalign: The y alignment of the label. A value of 0.0 aligns under 
+ *   the frame; 1.0 aligns above the frame.
+ * 
+ * Sets the alignment of the frame widget's label. The
+ * default values for a newly created frame are 0.0 and 0.5.
+ **/
 void
 gtk_frame_set_label_align (GtkFrame *frame,
                           gfloat    xalign,
@@ -418,13 +447,13 @@ gtk_frame_set_label_align (GtkFrame *frame,
   if (xalign != frame->label_xalign)
     {
       frame->label_xalign = xalign;
-      g_object_notify (G_OBJECT (frame), "label_xalign");
+      g_object_notify (G_OBJECT (frame), "label-xalign");
     }
 
   if (yalign != frame->label_yalign)
     {
       frame->label_yalign = yalign;
-      g_object_notify (G_OBJECT (frame), "label_yalign");
+      g_object_notify (G_OBJECT (frame), "label-yalign");
     }
 
   g_object_thaw_notify (G_OBJECT (frame));
@@ -453,6 +482,13 @@ gtk_frame_get_label_align (GtkFrame *frame,
     *yalign = frame->label_yalign;
 }
 
+/**
+ * gtk_frame_set_shadow_type:
+ * @frame: a #GtkFrame
+ * @type: the new #GtkShadowType
+ * 
+ * Sets the shadow type for @frame.
+ **/
 void
 gtk_frame_set_shadow_type (GtkFrame      *frame,
                           GtkShadowType  type)
@@ -462,7 +498,7 @@ gtk_frame_set_shadow_type (GtkFrame      *frame,
   if ((GtkShadowType) frame->shadow_type != type)
     {
       frame->shadow_type = type;
-      g_object_notify (G_OBJECT (frame), "shadow_type");
+      g_object_notify (G_OBJECT (frame), "shadow-type");
 
       if (GTK_WIDGET_DRAWABLE (frame))
        {
@@ -502,7 +538,7 @@ gtk_frame_paint (GtkWidget    *widget,
       frame = GTK_FRAME (widget);
 
       x = frame->child_allocation.x - widget->style->xthickness;
-      y = frame->child_allocation.y; - widget->style->ythickness;
+      y = frame->child_allocation.y - widget->style->ythickness;
       width = frame->child_allocation.width + 2 * widget->style->xthickness;
       height =  frame->child_allocation.height + 2 * widget->style->ythickness;
 
@@ -521,14 +557,15 @@ gtk_frame_paint (GtkWidget    *widget,
            xalign = 1 - frame->label_xalign;
 
          height_extra = MAX (0, child_requisition.height - widget->style->ythickness);
-         y -= height_extra * (1 - frame->label_yalign);
-         height += height_extra * (1 - frame->label_yalign);
+         height_extra *= (1 - frame->label_yalign);
+         y -= height_extra;
+         height += height_extra;
          
          x2 = widget->style->xthickness + (frame->child_allocation.width - child_requisition.width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD) * xalign + LABEL_SIDE_PAD;
 
          
          gtk_paint_shadow_gap (widget->style, widget->window,
-                               GTK_STATE_NORMAL, frame->shadow_type,
+                               widget->state, frame->shadow_type,
                                area, widget, "frame",
                                x, y, width, height,
                                GTK_POS_TOP, 
@@ -536,7 +573,7 @@ gtk_frame_paint (GtkWidget    *widget,
        }
        else
         gtk_paint_shadow (widget->style, widget->window,
-                          GTK_STATE_NORMAL, frame->shadow_type,
+                          widget->state, frame->shadow_type,
                           area, widget, "frame",
                           x, y, width, height);
     }
@@ -682,3 +719,6 @@ gtk_frame_real_compute_child_allocation (GtkFrame      *frame,
   child_allocation->x += allocation->x;
   child_allocation->y += allocation->y;
 }
+
+#define __GTK_FRAME_C__
+#include "gtkaliasdef.c"