mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-05 08:51:28 +00:00
[ui] Propagate passage view size to its container
This gets the container view sized properly such that the scroll box has something to work with for determining how much the view can slide.
This commit is contained in:
parent
97a83bf1ed
commit
c460d03371
2 changed files with 12 additions and 3 deletions
|
@ -78,6 +78,7 @@ typedef struct imui_style_s {
|
|||
// to the reference)
|
||||
typedef struct imui_reference_s {
|
||||
uint32_t ref_id;
|
||||
bool update;
|
||||
struct imui_ctx_s *ctx; // owns entity if not null
|
||||
} imui_reference_t;
|
||||
|
||||
|
|
|
@ -803,6 +803,15 @@ calc_expansions (imui_ctx_t *ctx, hierref_t href)
|
|||
auto sub_view = View_FromEntity (ctx->vsys, sub->ref_id);
|
||||
View_SetLen (sub_view, len[i].x, len[i].y);
|
||||
calc_expansions (ctx, View_GetRef (sub_view));
|
||||
if (sub->update) {
|
||||
View_UpdateHierarchy (sub_view);
|
||||
if (cont[i].semantic_x == imui_size_fitchildren) {
|
||||
len[i].x = View_GetLen (sub_view).x;
|
||||
}
|
||||
if (cont[i].semantic_y == imui_size_fitchildren) {
|
||||
len[i].y = View_GetLen (sub_view).y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1228,15 +1237,13 @@ IMUI_Passage (imui_ctx_t *ctx, const char *name, struct passage_s *passage)
|
|||
.gravity = grav_northwest,
|
||||
.visible = 1,
|
||||
.semantic_x = imui_size_expand,
|
||||
.semantic_y = imui_size_expand,
|
||||
.semantic_y = imui_size_fitchildren,
|
||||
.vertical = true,
|
||||
.active = 1,
|
||||
};
|
||||
auto reg = ctx->csys.reg;
|
||||
Ent_SetComponent (anchor_view.id, c_fraction_x, reg,
|
||||
&(imui_frac_t) { 100, 100 });
|
||||
Ent_SetComponent (anchor_view.id, c_fraction_y, reg,
|
||||
&(imui_frac_t) { 100, 100 });
|
||||
|
||||
auto state = imui_get_state (ctx, va (0, "%s#passage_anchor", name),
|
||||
anchor_view.id);
|
||||
|
@ -1265,6 +1272,7 @@ IMUI_Passage (imui_ctx_t *ctx, const char *name, struct passage_s *passage)
|
|||
View_Control (anchor_view)->is_link = 1;
|
||||
imui_reference_t link = {
|
||||
.ref_id = psg_view.id,
|
||||
.update = true,
|
||||
};
|
||||
Ent_SetComponent (anchor_view.id, c_reference, anchor_view.reg, &link);
|
||||
|
||||
|
|
Loading…
Reference in a new issue