added unscaleable tiled layout slots to scaleable tiled layouts
This commit is contained in:
parent
899aaf0fda
commit
c0d770a08f
25
gui.c
25
gui.c
@ -2313,12 +2313,13 @@ gui_panel_begin_tiled(struct gui_panel_layout *tile, struct gui_panel *panel,
|
|||||||
|
|
||||||
switch (slot) {
|
switch (slot) {
|
||||||
case GUI_SLOT_TOP:
|
case GUI_SLOT_TOP:
|
||||||
|
s = &layout->slots[GUI_SLOT_TOP];
|
||||||
scaler.x = bounds.x;
|
scaler.x = bounds.x;
|
||||||
scaler.y = (bounds.y + bounds.h) - config->scaler_width;
|
scaler.y = (bounds.y + bounds.h) - config->scaler_width;
|
||||||
scaler.w = bounds.w;
|
scaler.w = bounds.w;
|
||||||
scaler.h = config->scaler_width;
|
scaler.h = config->scaler_width;
|
||||||
|
|
||||||
if (in && !(layout->flags & GUI_LAYOUT_INACTIVE) && in->mouse_down &&
|
if (in && s->state != GUI_LOCKED && !(layout->flags & GUI_LAYOUT_INACTIVE) && in->mouse_down &&
|
||||||
GUI_INBOX(mpos.x, mpos.y, scaler.x, scaler.y, scaler.w, scaler.h)) {
|
GUI_INBOX(mpos.x, mpos.y, scaler.x, scaler.y, scaler.w, scaler.h)) {
|
||||||
gui_float py, dy = in->mouse_delta.y;
|
gui_float py, dy = in->mouse_delta.y;
|
||||||
|
|
||||||
@ -2339,12 +2340,13 @@ gui_panel_begin_tiled(struct gui_panel_layout *tile, struct gui_panel *panel,
|
|||||||
bounds.h -= config->scaler_width;
|
bounds.h -= config->scaler_width;
|
||||||
break;
|
break;
|
||||||
case GUI_SLOT_BOTTOM:
|
case GUI_SLOT_BOTTOM:
|
||||||
|
s = &layout->slots[GUI_SLOT_BOTTOM];
|
||||||
scaler.x = bounds.x;
|
scaler.x = bounds.x;
|
||||||
scaler.y = bounds.y;
|
scaler.y = bounds.y;
|
||||||
scaler.w = bounds.w;
|
scaler.w = bounds.w;
|
||||||
scaler.h = config->scaler_width;
|
scaler.h = config->scaler_width;
|
||||||
|
|
||||||
if (in && !(layout->flags & GUI_LAYOUT_INACTIVE) && in->mouse_down &&
|
if (in && s->state != GUI_LOCKED && !(layout->flags & GUI_LAYOUT_INACTIVE) && in->mouse_down &&
|
||||||
GUI_INBOX(mpos.x, mpos.y, scaler.x, scaler.y, scaler.w, scaler.h)) {
|
GUI_INBOX(mpos.x, mpos.y, scaler.x, scaler.y, scaler.w, scaler.h)) {
|
||||||
gui_float py, dy = in->mouse_delta.y;
|
gui_float py, dy = in->mouse_delta.y;
|
||||||
|
|
||||||
@ -2364,12 +2366,13 @@ gui_panel_begin_tiled(struct gui_panel_layout *tile, struct gui_panel *panel,
|
|||||||
bounds.h -= config->scaler_width;
|
bounds.h -= config->scaler_width;
|
||||||
break;
|
break;
|
||||||
case GUI_SLOT_LEFT:
|
case GUI_SLOT_LEFT:
|
||||||
|
s = &layout->slots[GUI_SLOT_LEFT];
|
||||||
scaler.x = bounds.x + bounds.w - config->scaler_width;
|
scaler.x = bounds.x + bounds.w - config->scaler_width;
|
||||||
scaler.y = bounds.y;
|
scaler.y = bounds.y;
|
||||||
scaler.w = config->scaler_width;
|
scaler.w = config->scaler_width;
|
||||||
scaler.h = bounds.h;
|
scaler.h = bounds.h;
|
||||||
|
|
||||||
if (in && !(layout->flags & GUI_LAYOUT_INACTIVE) && in->mouse_down &&
|
if (in && s->state != GUI_LOCKED && !(layout->flags & GUI_LAYOUT_INACTIVE) && in->mouse_down &&
|
||||||
GUI_INBOX(mpos.x, mpos.y, scaler.x, scaler.y, scaler.w, scaler.h)) {
|
GUI_INBOX(mpos.x, mpos.y, scaler.x, scaler.y, scaler.w, scaler.h)) {
|
||||||
gui_float dx = in->mouse_delta.x;
|
gui_float dx = in->mouse_delta.x;
|
||||||
gui_float cx, rx;
|
gui_float cx, rx;
|
||||||
@ -2391,12 +2394,13 @@ gui_panel_begin_tiled(struct gui_panel_layout *tile, struct gui_panel *panel,
|
|||||||
bounds.w -= config->scaler_width;
|
bounds.w -= config->scaler_width;
|
||||||
break;
|
break;
|
||||||
case GUI_SLOT_RIGHT:
|
case GUI_SLOT_RIGHT:
|
||||||
|
s = &layout->slots[GUI_SLOT_LEFT];
|
||||||
scaler.x = bounds.x;
|
scaler.x = bounds.x;
|
||||||
scaler.y = bounds.y;
|
scaler.y = bounds.y;
|
||||||
scaler.w = config->scaler_width;
|
scaler.w = config->scaler_width;
|
||||||
scaler.h = bounds.h;
|
scaler.h = bounds.h;
|
||||||
|
|
||||||
if (in && !(layout->flags & GUI_LAYOUT_INACTIVE) && in->mouse_down &&
|
if (in && s->state != GUI_LOCKED && !(layout->flags & GUI_LAYOUT_INACTIVE) && in->mouse_down &&
|
||||||
GUI_INBOX(mpos.x, mpos.y, scaler.x, scaler.y, scaler.w, scaler.h)) {
|
GUI_INBOX(mpos.x, mpos.y, scaler.x, scaler.y, scaler.w, scaler.h)) {
|
||||||
gui_float dx = in->mouse_delta.x;
|
gui_float dx = in->mouse_delta.x;
|
||||||
gui_float cx, lx;
|
gui_float cx, lx;
|
||||||
@ -3880,6 +3884,19 @@ gui_layout_slot(struct gui_layout *layout, enum gui_layout_slot_index slot,
|
|||||||
layout->slots[slot].capacity = count;
|
layout->slots[slot].capacity = count;
|
||||||
layout->slots[slot].format = format;
|
layout->slots[slot].format = format;
|
||||||
layout->slots[slot].value = GUI_SATURATE(ratio);
|
layout->slots[slot].value = GUI_SATURATE(ratio);
|
||||||
|
layout->slots[slot].state = GUI_UNLOCKED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gui_layout_slot_locked(struct gui_layout *layout, enum gui_layout_slot_index slot,
|
||||||
|
gui_float ratio, enum gui_layout_format format, gui_size count)
|
||||||
|
{
|
||||||
|
GUI_ASSERT(layout);
|
||||||
|
GUI_ASSERT(count);
|
||||||
|
GUI_ASSERT(slot >= GUI_SLOT_TOP && slot < GUI_SLOT_MAX);
|
||||||
|
if (!layout || !count) return;
|
||||||
|
gui_layout_slot(layout, slot, ratio, format, count);
|
||||||
|
layout->slots[slot].state = GUI_LOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
13
gui.h
13
gui.h
@ -2281,6 +2281,11 @@ enum gui_layout_format {
|
|||||||
/* panels in slots are added top to bottom */
|
/* panels in slots are added top to bottom */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum gui_layout_slot_state {
|
||||||
|
GUI_UNLOCKED,
|
||||||
|
GUI_LOCKED
|
||||||
|
};
|
||||||
|
|
||||||
struct gui_layout_slot {
|
struct gui_layout_slot {
|
||||||
gui_size capacity;
|
gui_size capacity;
|
||||||
/* number of panels inside the slot */
|
/* number of panels inside the slot */
|
||||||
@ -2292,6 +2297,8 @@ struct gui_layout_slot {
|
|||||||
/* position of the slot in the window */
|
/* position of the slot in the window */
|
||||||
enum gui_layout_format format;
|
enum gui_layout_format format;
|
||||||
/* panel filling layout */
|
/* panel filling layout */
|
||||||
|
enum gui_layout_slot_state state;
|
||||||
|
/* scaleable state */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum gui_layout_state {
|
enum gui_layout_state {
|
||||||
@ -2320,8 +2327,10 @@ struct gui_layout {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void gui_layout_begin(struct gui_layout*, gui_size width, gui_size height, gui_flags);
|
void gui_layout_begin(struct gui_layout*, gui_size width, gui_size height, gui_flags);
|
||||||
void gui_layout_slot(struct gui_layout*, enum gui_layout_slot_index,
|
void gui_layout_slot(struct gui_layout*, enum gui_layout_slot_index, gui_float ratio,
|
||||||
gui_float ratio, enum gui_layout_format, gui_size panel_count);
|
enum gui_layout_format, gui_size panel_count);
|
||||||
|
void gui_layout_slot_locked(struct gui_layout*, enum gui_layout_slot_index, gui_float ratio,
|
||||||
|
enum gui_layout_format, gui_size panel_count);
|
||||||
void gui_layout_end(struct gui_layout*);
|
void gui_layout_end(struct gui_layout*);
|
||||||
void gui_layout_update_size(struct gui_layout*, gui_size width, gui_size height);
|
void gui_layout_update_size(struct gui_layout*, gui_size width, gui_size height);
|
||||||
void gui_layout_update_state(struct gui_layout*, gui_uint state);
|
void gui_layout_update_state(struct gui_layout*, gui_uint state);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user