finished scroll_view
This commit is contained in:
@@ -185,7 +185,6 @@ typedef struct TimPanel {
|
||||
i32 len; // number of items
|
||||
i32 cur; // index of current item
|
||||
i32 spacing; // distance between items
|
||||
bool draw_border;
|
||||
bool is_horizontal;
|
||||
} TimPanel;
|
||||
|
||||
@@ -273,13 +272,22 @@ i32 tim_enter_scope(i32 x, i32 y, i32 w, i32 h);
|
||||
// exit scope and pop stack
|
||||
i32 tim_exit_scope(void);
|
||||
|
||||
static inline bool tim_rect_does_fit(TimRect r){
|
||||
return (
|
||||
r.x >= 0 && r.y >= 0 &&
|
||||
r.w >= 0 && r.h >= 0 &&
|
||||
r.x + r.w <= tim->w &&
|
||||
r.y + r.h <= tim->h
|
||||
);
|
||||
static inline TimRect tim_rect_fit(TimRect r){
|
||||
if(r.x < 0)
|
||||
r.x = 0;
|
||||
else if(r.x >= tim->w)
|
||||
r.w = 0;
|
||||
else if(r.x + r.w > tim->w)
|
||||
r.w = tim->w - r.x;
|
||||
|
||||
if(r.y < 0)
|
||||
r.y = 0;
|
||||
else if(r.y >= tim->h)
|
||||
r.y = tim->h - 1;
|
||||
else if(r.y + r.h > tim->h)
|
||||
r.h = tim->h - r.y;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
@@ -336,9 +344,8 @@ void TimEditState_delete(TimEditState* e);
|
||||
/// Panel with sequence of items. You can select an item by arrow keys or mouse click.
|
||||
/// @param self persistent state
|
||||
/// @param is_selected if panel is not selected, it calls items[:]->draw(is_selected=false)
|
||||
/// @param style frame, background, text
|
||||
/// @return current item
|
||||
TimPanelItem* tim_panel(TimPanel* self, bool is_selected, i32 x, i32 y, i32 w, i32 h, TimStyle style);
|
||||
TimPanelItem* tim_panel(TimPanel* self, bool is_selected, i32 x, i32 y, i32 w, i32 h);
|
||||
|
||||
void TimPanel_selectNext(TimPanel* self);
|
||||
void TimPanel_selectPrev(TimPanel* self);
|
||||
|
||||
Reference in New Issue
Block a user