mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 22:12:47 -05:00
Improve the align_next_to mechanism.
Various alignments I want to do in the host CA box have shown up deficiencies in this system, so I've reworked it a bit. Firstly, you can now specify more than two controls to be tied together with an align_next_to (e.g. multiple checkboxes alongside something else). Secondly, as well as forcing the controls to be the same height as each other, the layout algorithm will also move the later controls further _downward_, so that their top y positions also line up. Until now that hasn't been necessary, because they lined up already. In the GTK implementation of this via the Columns class, I've renamed 'columns_force_same_height' to 'columns_align_next_to', and similarly for some of the internal fields, since the latter change makes the previous names a misnomer. In the Windows implementation, I found it most convenient to set this up by following a linked list of align_next_to fields backwards. But it won't always be convenient to initialise them that way, so I've also written a crude normaliser that will rewrite those links into a canonical form. But I only call that on Windows; it's unnecessary in GTK, where the Columns class provides plenty of per-widget extra storage so I just keep each alignment class as a circular list.
This commit is contained in:
@ -43,11 +43,17 @@ struct ColumnsChild_tag {
|
||||
GtkWidget *widget;
|
||||
gint colstart, colspan;
|
||||
bool force_left; /* for recalcitrant GtkLabels */
|
||||
ColumnsChild *same_height_as;
|
||||
/* Otherwise, this entry represents a change in the column setup. */
|
||||
gint ncols;
|
||||
gint *percentages;
|
||||
gint x, y, w, h; /* used during an individual size computation */
|
||||
|
||||
/* Circularly linked list of children that are vertically aligned
|
||||
* with each other. */
|
||||
ColumnsChild *valign_next, *valign_prev;
|
||||
|
||||
/* Temporary space used within some methods */
|
||||
bool visited;
|
||||
};
|
||||
|
||||
GType columns_get_type(void);
|
||||
@ -57,7 +63,7 @@ void columns_add(Columns *cols, GtkWidget *child,
|
||||
gint colstart, gint colspan);
|
||||
void columns_taborder_last(Columns *cols, GtkWidget *child);
|
||||
void columns_force_left_align(Columns *cols, GtkWidget *child);
|
||||
void columns_force_same_height(Columns *cols, GtkWidget *ch1, GtkWidget *ch2);
|
||||
void columns_align_next_to(Columns *cols, GtkWidget *ch1, GtkWidget *ch2);
|
||||
void columns_vexpand(Columns *cols, GtkWidget *child);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Reference in New Issue
Block a user