libgimpwidgets: add GtkGrid variants of gimp_[color_]scale_entry_new()
as temporary porting hack, they will eventually be renamed to the old names once GtkGrid porting is done.
This commit is contained in:
parent
37e24d0059
commit
1ce246f2da
2 changed files with 170 additions and 13 deletions
|
|
@ -41,7 +41,7 @@ static gboolean gimp_scale_entry_log_to_linear (GBinding *binding,
|
|||
gpointer user_data);
|
||||
|
||||
static GtkAdjustment * gimp_scale_entry_new_internal (gboolean color_scale,
|
||||
GtkTable *table,
|
||||
GtkWidget *grid,
|
||||
gint column,
|
||||
gint row,
|
||||
const gchar *text,
|
||||
|
|
@ -104,7 +104,7 @@ gimp_scale_entry_log_to_linear (GBinding *binding,
|
|||
|
||||
static GtkAdjustment *
|
||||
gimp_scale_entry_new_internal (gboolean color_scale,
|
||||
GtkTable *table,
|
||||
GtkWidget *parent,
|
||||
gint column,
|
||||
gint row,
|
||||
const gchar *text,
|
||||
|
|
@ -188,17 +188,32 @@ gimp_scale_entry_new_internal (gboolean color_scale,
|
|||
gtk_widget_set_size_request (scale, scale_width, -1);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), label,
|
||||
column, column + 1, row, row + 1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
if (GTK_IS_GRID (parent))
|
||||
{
|
||||
GtkGrid *grid = GTK_GRID (parent);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), scale,
|
||||
column + 1, column + 2, row, row + 1,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
gtk_widget_set_hexpand (scale, TRUE);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), spinbutton,
|
||||
column + 2, column + 3, row, row + 1,
|
||||
GTK_FILL | GTK_SHRINK, GTK_SHRINK, 0, 0);
|
||||
gtk_grid_attach (grid, label, column, row, 1, 1);
|
||||
gtk_grid_attach (grid, scale, column + 1, row, 1, 1);
|
||||
gtk_grid_attach (grid, spinbutton, column + 2, row, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkTable *table = GTK_TABLE (parent);
|
||||
|
||||
gtk_table_attach (table, label,
|
||||
column, column + 1, row, row + 1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
|
||||
gtk_table_attach (table, scale,
|
||||
column + 1, column + 2, row, row + 1,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
|
||||
gtk_table_attach (table, spinbutton,
|
||||
column + 2, column + 3, row, row + 1,
|
||||
GTK_FILL | GTK_SHRINK, GTK_SHRINK, 0, 0);
|
||||
}
|
||||
|
||||
if (tooltip || help_id)
|
||||
{
|
||||
|
|
@ -264,7 +279,67 @@ gimp_scale_entry_new (GtkTable *table,
|
|||
const gchar *help_id)
|
||||
{
|
||||
return gimp_scale_entry_new_internal (FALSE,
|
||||
table, column, row,
|
||||
GTK_WIDGET (table), column, row,
|
||||
text, scale_width, spinbutton_width,
|
||||
value, lower, upper,
|
||||
step_increment, page_increment,
|
||||
digits,
|
||||
constrain,
|
||||
unconstrained_lower,
|
||||
unconstrained_upper,
|
||||
tooltip, help_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_scale_entry_new_grid:
|
||||
* @grid: The #GtkGrid the widgets will be attached to.
|
||||
* @column: The column to start with.
|
||||
* @row: The row to attach the widgets.
|
||||
* @text: The text for the #GtkLabel which will appear
|
||||
* left of the #GtkHScale.
|
||||
* @scale_width: The minimum horizontal size of the #GtkHScale.
|
||||
* @spinbutton_width: The minimum horizontal size of the #GtkSpinButton.
|
||||
* @value: The initial value.
|
||||
* @lower: The lower boundary.
|
||||
* @upper: The upper boundary.
|
||||
* @step_increment: The step increment.
|
||||
* @page_increment: The page increment.
|
||||
* @digits: The number of decimal digits.
|
||||
* @constrain: %TRUE if the range of possible values of the
|
||||
* #GtkSpinButton should be the same as of the #GtkHScale.
|
||||
* @unconstrained_lower: The spinbutton's lower boundary
|
||||
* if @constrain == %FALSE.
|
||||
* @unconstrained_upper: The spinbutton's upper boundary
|
||||
* if @constrain == %FALSE.
|
||||
* @tooltip: A tooltip message for the scale and the spinbutton.
|
||||
* @help_id: The widgets' help_id (see gimp_help_set_help_data()).
|
||||
*
|
||||
* This function creates a #GtkLabel, a #GtkHScale and a #GtkSpinButton and
|
||||
* attaches them to a 3-column #GtkGrid.
|
||||
*
|
||||
* Returns: The #GtkSpinButton's #GtkAdjustment.
|
||||
**/
|
||||
GtkAdjustment *
|
||||
gimp_scale_entry_new_grid (GtkGrid *grid,
|
||||
gint column,
|
||||
gint row,
|
||||
const gchar *text,
|
||||
gint scale_width,
|
||||
gint spinbutton_width,
|
||||
gdouble value,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gdouble step_increment,
|
||||
gdouble page_increment,
|
||||
guint digits,
|
||||
gboolean constrain,
|
||||
gdouble unconstrained_lower,
|
||||
gdouble unconstrained_upper,
|
||||
const gchar *tooltip,
|
||||
const gchar *help_id)
|
||||
{
|
||||
return gimp_scale_entry_new_internal (FALSE,
|
||||
GTK_WIDGET (grid), column, row,
|
||||
text, scale_width, spinbutton_width,
|
||||
value, lower, upper,
|
||||
step_increment, page_increment,
|
||||
|
|
@ -315,7 +390,56 @@ gimp_color_scale_entry_new (GtkTable *table,
|
|||
const gchar *help_id)
|
||||
{
|
||||
return gimp_scale_entry_new_internal (TRUE,
|
||||
table, column, row,
|
||||
GTK_WIDGET (table), column, row,
|
||||
text, scale_width, spinbutton_width,
|
||||
value, lower, upper,
|
||||
step_increment, page_increment,
|
||||
digits,
|
||||
TRUE, 0.0, 0.0,
|
||||
tooltip, help_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_color_scale_entry_new_grid:
|
||||
* @grid: The #GtkGrid the widgets will be attached to.
|
||||
* @column: The column to start with.
|
||||
* @row: The row to attach the widgets.
|
||||
* @text: The text for the #GtkLabel which will appear
|
||||
* left of the #GtkHScale.
|
||||
* @scale_width: The minimum horizontal size of the #GtkHScale.
|
||||
* @spinbutton_width: The minimum horizontal size of the #GtkSpinButton.
|
||||
* @value: The initial value.
|
||||
* @lower: The lower boundary.
|
||||
* @upper: The upper boundary.
|
||||
* @step_increment: The step increment.
|
||||
* @page_increment: The page increment.
|
||||
* @digits: The number of decimal digits.
|
||||
* @tooltip: A tooltip message for the scale and the spinbutton.
|
||||
* @help_id: The widgets' help_id (see gimp_help_set_help_data()).
|
||||
*
|
||||
* This function creates a #GtkLabel, a #GimpColorScale and a
|
||||
* #GtkSpinButton and attaches them to a 3-column #GtkGrid.
|
||||
*
|
||||
* Returns: The #GtkSpinButton's #GtkAdjustment.
|
||||
**/
|
||||
GtkAdjustment *
|
||||
gimp_color_scale_entry_new_grid (GtkGrid *grid,
|
||||
gint column,
|
||||
gint row,
|
||||
const gchar *text,
|
||||
gint scale_width,
|
||||
gint spinbutton_width,
|
||||
gdouble value,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gdouble step_increment,
|
||||
gdouble page_increment,
|
||||
guint digits,
|
||||
const gchar *tooltip,
|
||||
const gchar *help_id)
|
||||
{
|
||||
return gimp_scale_entry_new_internal (TRUE,
|
||||
GTK_WIDGET (grid), column, row,
|
||||
text, scale_width, spinbutton_width,
|
||||
value, lower, upper,
|
||||
step_increment, page_increment,
|
||||
|
|
|
|||
|
|
@ -96,6 +96,24 @@ GtkAdjustment * gimp_scale_entry_new (GtkTable *table,
|
|||
const gchar *tooltip,
|
||||
const gchar *help_id);
|
||||
|
||||
GtkAdjustment * gimp_scale_entry_new_grid (GtkGrid *grid,
|
||||
gint column,
|
||||
gint row,
|
||||
const gchar *text,
|
||||
gint scale_width,
|
||||
gint spinbutton_width,
|
||||
gdouble value,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gdouble step_increment,
|
||||
gdouble page_increment,
|
||||
guint digits,
|
||||
gboolean constrain,
|
||||
gdouble unconstrained_lower,
|
||||
gdouble unconstrained_upper,
|
||||
const gchar *tooltip,
|
||||
const gchar *help_id);
|
||||
|
||||
GtkAdjustment * gimp_color_scale_entry_new (GtkTable *table,
|
||||
gint column,
|
||||
gint row,
|
||||
|
|
@ -111,6 +129,21 @@ GtkAdjustment * gimp_color_scale_entry_new (GtkTable *table,
|
|||
const gchar *tooltip,
|
||||
const gchar *help_id);
|
||||
|
||||
GtkAdjustment * gimp_color_scale_entry_new_grid (GtkGrid *grid,
|
||||
gint column,
|
||||
gint row,
|
||||
const gchar *text,
|
||||
gint scale_width,
|
||||
gint spinbutton_width,
|
||||
gdouble value,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gdouble step_increment,
|
||||
gdouble page_increment,
|
||||
guint digits,
|
||||
const gchar *tooltip,
|
||||
const gchar *help_id);
|
||||
|
||||
void gimp_scale_entry_set_sensitive (GtkAdjustment *adjustment,
|
||||
gboolean sensitive);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue