summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-12 22:12:31 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-12 22:12:31 +0300
commitfab098d5701a55fd4a0b3fb74ae332797e3be377 (patch)
tree7ce0ba598371eabffa4b06438126199fccf20841 /src/ui
parentbcd864988cefc34ea1bcb963e8f37f7bd3717481 (diff)
SidebarWidget: Minimum width; resizer appearance
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/sidebarwidget.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 9f733426..8ca2e448 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -177,7 +177,7 @@ void init_SidebarWidget(iSidebarWidget *d) {
177 resizeToParentHeight_WidgetFlag | moveToParentRightEdge_WidgetFlag); 177 resizeToParentHeight_WidgetFlag | moveToParentRightEdge_WidgetFlag);
178 setId_Widget(d->resizer, "sidebar.grab"); 178 setId_Widget(d->resizer, "sidebar.grab");
179 d->resizer->rect.size.x = gap_UI; 179 d->resizer->rect.size.x = gap_UI;
180 setBackgroundColor_Widget(d->resizer, red_ColorId); 180 setBackgroundColor_Widget(d->resizer, none_ColorId);
181 d->resizeCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE); 181 d->resizeCursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
182} 182}
183 183
@@ -257,13 +257,13 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
257 if (argLabel_Command(cmd, "button") == SDL_BUTTON_LEFT) { 257 if (argLabel_Command(cmd, "button") == SDL_BUTTON_LEFT) {
258 if (arg_Command(cmd)) { 258 if (arg_Command(cmd)) {
259 setFlags_Widget(d->resizer, pressed_WidgetFlag, iTrue); 259 setFlags_Widget(d->resizer, pressed_WidgetFlag, iTrue);
260 setBackgroundColor_Widget(d->resizer, orange_ColorId); 260 setBackgroundColor_Widget(d->resizer, gray75_ColorId);
261 setMouseGrab_Widget(d->resizer); 261 setMouseGrab_Widget(d->resizer);
262 refresh_Widget(d->resizer); 262 refresh_Widget(d->resizer);
263 } 263 }
264 else { 264 else {
265 setFlags_Widget(d->resizer, pressed_WidgetFlag, iFalse); 265 setFlags_Widget(d->resizer, pressed_WidgetFlag, iFalse);
266 setBackgroundColor_Widget(d->resizer, red_ColorId); 266 setBackgroundColor_Widget(d->resizer, none_ColorId);
267 setMouseGrab_Widget(NULL); 267 setMouseGrab_Widget(NULL);
268 refresh_Widget(d->resizer); 268 refresh_Widget(d->resizer);
269 } 269 }
@@ -274,7 +274,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
274 const char *cmd = command_UserEvent(ev); 274 const char *cmd = command_UserEvent(ev);
275 if (isResizing_SidebarWidget_(d)) { 275 if (isResizing_SidebarWidget_(d)) {
276 const iInt2 local = localCoord_Widget(w, coord_Command(cmd)); 276 const iInt2 local = localCoord_Widget(w, coord_Command(cmd));
277 w->rect.size.x = local.x + d->resizer->rect.size.x / 2; 277 w->rect.size.x = iMax(30 * gap_UI, local.x + d->resizer->rect.size.x / 2);
278 arrange_Widget(findWidget_App("doctabs")); 278 arrange_Widget(findWidget_App("doctabs"));
279 checkModeButtonLayout_SidebarWidget_(d); 279 checkModeButtonLayout_SidebarWidget_(d);
280 if (!isRefreshPending_App()) { 280 if (!isRefreshPending_App()) {
@@ -376,6 +376,10 @@ static void draw_SidebarWidget_(const iSidebarWidget *d) {
376 } 376 }
377 } 377 }
378 draw_Widget(w); 378 draw_Widget(w);
379 drawVLine_Paint(&p,
380 addX_I2(topRight_Rect(bounds_Widget(w)), -1),
381 height_Rect(bounds_Widget(w)),
382 black_ColorId);
379} 383}
380 384
381iBeginDefineSubclass(SidebarWidget, Widget) 385iBeginDefineSubclass(SidebarWidget, Widget)