Move layout constants into an enumeration, split GTK_BUTTONBOX_DEFAULT

Wed Feb 25 13:18:53 1998  Owen Taylor  <owt1@cornell.edu>

	* gtk/gtkbbox.[ch] gtk/gtkhbox.[ch] gtk/gtkvbox.[ch] :

	Move layout constants into an enumeration, split
	GTK_BUTTONBOX_DEFAULT into GTK_BUTTONBOX_DEFAULT
	and GTK_BUTTONBOX_DEFAULT_STYLE (enumeration member).

	* gtk/gtkclist.c:

	Renamed gtk_clist_row_isvisable to .._is_visible

	From: Maciej Stachowiak <mstachow@mit.edu>
This commit is contained in:
Owen Taylor 1998-02-25 18:36:39 +00:00 committed by Owen Taylor
parent 97bbc97bb2
commit 777159913b
8 changed files with 61 additions and 45 deletions

View File

@ -68,7 +68,7 @@ gtk_button_box_init (GtkButtonBox *button_box)
button_box->child_min_height = GTK_BUTTONBOX_DEFAULT;
button_box->child_ipad_x = GTK_BUTTONBOX_DEFAULT;
button_box->child_ipad_y = GTK_BUTTONBOX_DEFAULT;
button_box->layout_style = GTK_BUTTONBOX_DEFAULT;
button_box->layout_style = GTK_BUTTONBOX_DEFAULT_STYLE;
}
@ -121,8 +121,12 @@ void gtk_button_box_set_child_ipadding (GtkButtonBox *widget,
widget->child_ipad_y = ipad_y;
}
void gtk_button_box_set_layout (GtkButtonBox *widget, gint layout_style)
void gtk_button_box_set_layout (GtkButtonBox *widget,
GtkButtonBoxStyle layout_style)
{
g_return_if_fail (layout_style >= GTK_BUTTONBOX_DEFAULT_STYLE &&
layout_style <= GTK_BUTTONBOX_END);
widget->layout_style = layout_style;
}
@ -148,7 +152,7 @@ void gtk_button_box_get_child_ipadding (GtkButtonBox *widget,
*ipad_y = widget->child_ipad_y;
}
gint gtk_button_box_get_layout (GtkButtonBox *widget)
GtkButtonBoxStyle gtk_button_box_get_layout (GtkButtonBox *widget)
{
return widget->layout_style;
}

View File

@ -24,17 +24,22 @@
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GTK_BUTTON_BOX(obj) GTK_CHECK_CAST (obj, gtk_button_box_get_type (), GtkButtonBox)
#define GTK_BUTTON_BOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_button_box_get_type (), GtkButtonBoxClass)
#define GTK_IS_BUTTON_BOX(obj) GTK_CHECK_TYPE (obj, gtk_button_box_get_type ())
#define GTK_BUTTONBOX_DEFAULT -1
#define GTK_BUTTONBOX_SPREAD 1
#define GTK_BUTTONBOX_EDGE 2
#define GTK_BUTTONBOX_START 3
#define GTK_BUTTONBOX_END 4
typedef enum {
GTK_BUTTONBOX_DEFAULT_STYLE,
GTK_BUTTONBOX_SPREAD,
GTK_BUTTONBOX_EDGE,
GTK_BUTTONBOX_START,
GTK_BUTTONBOX_END
} GtkButtonBoxStyle;
typedef struct _GtkButtonBox GtkButtonBox;
typedef struct _GtkButtonBoxClass GtkButtonBoxClass;
@ -47,7 +52,7 @@ struct _GtkButtonBox
gint child_min_height;
gint child_ipad_x;
gint child_ipad_y;
gint layout_style;
GtkButtonBoxStyle layout_style;
};
struct _GtkButtonBoxClass
@ -65,13 +70,14 @@ void gtk_button_box_set_child_size_default (gint min_width, gint min_height);
void gtk_button_box_set_child_ipadding_default (gint ipad_x, gint ipad_y);
gint gtk_button_box_get_spacing (GtkButtonBox *widget);
gint gtk_button_box_get_layout (GtkButtonBox *widget);
GtkButtonBoxStyle gtk_button_box_get_layout (GtkButtonBox *widget);
void gtk_button_box_get_child_size (GtkButtonBox *widget,
gint *min_width, gint *min_height);
void gtk_button_box_get_child_ipadding (GtkButtonBox *widget, gint *ipad_x, gint *ipad_y);
void gtk_button_box_set_spacing (GtkButtonBox *widget, gint spacing);
void gtk_button_box_set_layout (GtkButtonBox *widget, gint layout_style);
void gtk_button_box_set_layout (GtkButtonBox *widget,
GtkButtonBoxStyle layout_style);
void gtk_button_box_set_child_size (GtkButtonBox *widget,
gint min_width, gint min_height);
void gtk_button_box_set_child_ipadding (GtkButtonBox *widget, gint ipad_x, gint ipad_y);

View File

@ -933,7 +933,7 @@ gtk_clist_set_text (GtkCList * clist,
/* redraw the list if it's not frozen */
if (!GTK_CLIST_FROZEN (clist))
{
if (gtk_clist_row_isvisable (clist, row))
if (gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}
}
@ -989,7 +989,7 @@ gtk_clist_set_pixmap (GtkCList * clist,
/* redraw the list if it's not frozen */
if (!GTK_CLIST_FROZEN (clist))
{
if (gtk_clist_row_isvisable (clist, row))
if (gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}
}
@ -1050,7 +1050,7 @@ gtk_clist_set_pixtext (GtkCList * clist,
/* redraw the list if it's not frozen */
if (!GTK_CLIST_FROZEN (clist))
{
if (gtk_clist_row_isvisable (clist, row))
if (gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}
}
@ -1107,7 +1107,7 @@ gtk_clist_set_foreground (GtkCList * clist,
clist_row->foreground = *color;
clist_row->fg_set = TRUE;
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_isvisable (clist, row))
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}
@ -1127,7 +1127,7 @@ void gtk_clist_set_background (GtkCList * clist,
clist_row->background = *color;
clist_row->bg_set = TRUE;
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_isvisable (clist, row))
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}
@ -1152,7 +1152,7 @@ gtk_clist_set_shift (GtkCList * clist,
clist_row->cell[column].vertical = vertical;
clist_row->cell[column].horizontal = horizontal;
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_isvisable (clist, row))
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}
@ -1201,7 +1201,7 @@ gtk_clist_append (GtkCList * clist,
{
adjust_scrollbars (clist);
if (gtk_clist_row_isvisable (clist, clist->rows - 1))
if (gtk_clist_row_is_visible (clist, clist->rows - 1))
draw_rows (clist, NULL);
}
@ -1252,7 +1252,7 @@ gtk_clist_insert (GtkCList * clist,
{
adjust_scrollbars (clist);
if (gtk_clist_row_isvisable (clist, row))
if (gtk_clist_row_is_visible (clist, row))
draw_rows (clist, NULL);
}
}
@ -1271,7 +1271,7 @@ gtk_clist_remove (GtkCList * clist,
if (row < 0 || row > (clist->rows - 1))
return;
was_visible = gtk_clist_row_isvisable (clist, row);
was_visible = gtk_clist_row_is_visible (clist, row);
/* get the row we're going to delete */
list = g_list_nth (clist->row_list, row);
@ -1461,7 +1461,7 @@ gtk_clist_unselect_row (GtkCList * clist,
}
gint
gtk_clist_row_isvisable (GtkCList * clist,
gtk_clist_row_is_visible (GtkCList * clist,
gint row)
{
g_return_val_if_fail (clist != NULL, 0);
@ -2775,7 +2775,7 @@ real_select_row (GtkCList * clist,
clist->selection = g_list_append (clist->selection, clist_row);
}
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_isvisable (clist, row))
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}
else if (clist_row->state == GTK_STATE_SELECTED)
@ -2803,7 +2803,7 @@ real_select_row (GtkCList * clist,
clist_row->state = GTK_STATE_SELECTED;
clist->selection = g_list_append (clist->selection, clist_row);
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_isvisable (clist, row))
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}
}
@ -2839,7 +2839,7 @@ real_select_row (GtkCList * clist,
clist_row->state = GTK_STATE_SELECTED;
}
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_isvisable (clist, row))
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}
@ -2872,7 +2872,7 @@ real_unselect_row (GtkCList * clist,
clist_row->state = GTK_STATE_NORMAL;
clist->selection = g_list_remove (clist->selection, clist_row);
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_isvisable (clist, row))
if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
draw_row (clist, NULL, row, clist_row);
}

View File

@ -352,8 +352,8 @@ void gtk_clist_moveto (GtkCList * clist,
gfloat col_align);
/* returns true if the row is visible */
gint gtk_clist_row_isvisable (GtkCList * clist,
gint row);
gint gtk_clist_row_is_visible (GtkCList * clist,
gint row);
/* returns the cell type */
GtkCellType gtk_clist_get_cell_type (GtkCList * clist,

View File

@ -91,8 +91,11 @@ void gtk_hbutton_box_set_spacing_default (gint spacing)
/* set default value for layout style */
void gtk_hbutton_box_set_layout_default (gint layout)
void gtk_hbutton_box_set_layout_default (GtkButtonBoxStyle layout)
{
g_return_if_fail (layout >= GTK_BUTTONBOX_DEFAULT_STYLE &&
layout <= GTK_BUTTONBOX_END);
default_layout_style = layout;
}
@ -106,7 +109,7 @@ gint gtk_hbutton_box_get_spacing_default (void)
/* get default value for layout style */
gint gtk_hbutton_box_get_layout_default (void)
GtkButtonBoxStyle gtk_hbutton_box_get_layout_default (void)
{
return default_layout_style;
}
@ -123,7 +126,7 @@ gtk_hbutton_box_size_request (GtkWidget *widget,
gint child_width;
gint child_height;
gint spacing;
gint layout;
GtkButtonBoxStyle layout;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_HBUTTON_BOX (widget));
@ -134,7 +137,7 @@ gtk_hbutton_box_size_request (GtkWidget *widget,
spacing = bbox->spacing != GTK_BUTTONBOX_DEFAULT
? bbox->spacing : default_spacing;
layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT
layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
? bbox->layout_style : default_layout_style;
gtk_button_box_child_requisition (widget,
@ -191,7 +194,7 @@ gtk_hbutton_box_size_allocate (GtkWidget *widget,
gint width;
gint childspace;
gint childspacing = 0;
gint layout;
GtkButtonBoxStyle layout;
gint spacing;
g_return_if_fail (widget != NULL);
@ -202,7 +205,7 @@ gtk_hbutton_box_size_allocate (GtkWidget *widget,
hbox = GTK_HBUTTON_BOX (widget);
spacing = box->spacing != GTK_BUTTONBOX_DEFAULT
? box->spacing : default_spacing;
layout = box->layout_style != GTK_BUTTONBOX_DEFAULT
layout = box->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
? box->layout_style : default_layout_style;
gtk_button_box_child_requisition (widget,
&nvis_children,

View File

@ -52,10 +52,10 @@ GtkWidget *gtk_hbutton_box_new (void);
/* buttons can be added by gtk_container_add() */
gint gtk_hbutton_box_get_spacing_default (void);
gint gtk_hbutton_box_get_layout_default (void);
GtkButtonBoxStyle gtk_hbutton_box_get_layout_default (void);
void gtk_hbutton_box_set_spacing_default (gint spacing);
void gtk_hbutton_box_set_layout_default (gint layout);
void gtk_hbutton_box_set_layout_default (GtkButtonBoxStyle layout);
#ifdef __cplusplus

View File

@ -26,7 +26,7 @@ static void gtk_vbutton_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gint default_spacing = 10;
static gint default_layout_style = GTK_BUTTONBOX_EDGE;
static GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE;
guint
gtk_vbutton_box_get_type ()
@ -90,8 +90,11 @@ void gtk_vbutton_box_set_spacing_default (gint spacing)
/* set default value for layout style */
void gtk_vbutton_box_set_layout_default (gint layout)
void gtk_vbutton_box_set_layout_default (GtkButtonBoxStyle layout)
{
g_return_if_fail (layout >= GTK_BUTTONBOX_DEFAULT_STYLE &&
layout <= GTK_BUTTONBOX_END);
default_layout_style = layout;
}
@ -106,14 +109,14 @@ gint gtk_vbutton_box_get_spacing_default (void)
/* get default value for layout style */
gint gtk_vbutton_box_get_layout_default (void)
GtkButtonBoxStyle gtk_vbutton_box_get_layout_default (void)
{
return default_layout_style;
}
static void
gtk_vbutton_box_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@ -124,7 +127,7 @@ gtk_vbutton_box_size_request (GtkWidget *widget,
gint child_width;
gint child_height;
gint spacing;
gint layout;
GtkButtonBoxStyle layout;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_VBUTTON_BOX (widget));
@ -135,7 +138,7 @@ gtk_vbutton_box_size_request (GtkWidget *widget,
spacing = bbox->spacing != GTK_BUTTONBOX_DEFAULT
? bbox->spacing : default_spacing;
layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT
layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
? bbox->layout_style : default_layout_style;
gtk_button_box_child_requisition (widget,
@ -193,7 +196,7 @@ gtk_vbutton_box_size_allocate (GtkWidget *widget,
gint height;
gint childspace;
gint childspacing = 0;
gint layout;
GtkButtonBoxStyle layout;
gint spacing;
g_return_if_fail (widget != NULL);
@ -204,7 +207,7 @@ gtk_vbutton_box_size_allocate (GtkWidget *widget,
hbox = GTK_VBUTTON_BOX (widget);
spacing = box->spacing != GTK_BUTTONBOX_DEFAULT
? box->spacing : default_spacing;
layout = box->layout_style != GTK_BUTTONBOX_DEFAULT
layout = box->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
? box->layout_style : default_layout_style;
gtk_button_box_child_requisition (widget,
&nvis_children,

View File

@ -54,8 +54,8 @@ GtkWidget *gtk_vbutton_box_new (void);
gint gtk_vbutton_box_get_spacing_default (void);
void gtk_vbutton_box_set_spacing_default (gint spacing);
gint gtk_vbutton_box_get_layout_default (void);
void gtk_vbutton_box_set_layout_default (gint layout);
GtkButtonBoxStyle gtk_vbutton_box_get_layout_default (void);
void gtk_vbutton_box_set_layout_default (GtkButtonBoxStyle layout);
#ifdef __cplusplus