Added uiNewVerticalSeparator().
This commit is contained in:
parent
605b09f2be
commit
9656a81c77
|
@ -23,6 +23,7 @@ This README is being written.<br>
|
|||
* **17 June 2016**
|
||||
* `uiMainSteps()` no longer takes any arguments and no longer needs to invoke a function to do the work. You still need to call it, but once you do, it will return immediately and you can then get right to your main loop.
|
||||
* **CMake 3.1.0 is now required.** This is due to CMake's rapid development pace in the past few years adding things libui needs to build on as many systems as possible. If your OS is supported by libui but its repositories ship with an older version of CMake, you will need to find an updated one somewhere.
|
||||
* Added `uiNewVerticalSeparator()` to complement `uiNewHorizontalSeparator()`.
|
||||
|
||||
* **16 June 2016**
|
||||
* Added `uiWindowContentSize()`, `uiWindowSetContentSize()`, and `uiWindowOnContentSizeChanged()` methods for manipulating uiWindow content sizes. Note the use of "content size"; the size you work with does NOT include window decorations (titlebars, menus, etc.).
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
// TODO make this intrinsic
|
||||
#define separatorWidth 96
|
||||
#define separatorHeight 96
|
||||
|
||||
struct uiSeparator {
|
||||
uiDarwinControl c;
|
||||
|
@ -26,3 +27,19 @@ uiSeparator *uiNewHorizontalSeparator(void)
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
uiSeparator *uiNewVerticalSeparator(void)
|
||||
{
|
||||
uiSeparator *s;
|
||||
|
||||
uiDarwinNewControl(uiSeparator, s);
|
||||
|
||||
// make the initial height >= initial width to force vertical
|
||||
s->box = [[NSBox alloc] initWithFrame:NSMakeRect(0, 0, 1, 100)];
|
||||
[s->box setBoxType:NSBoxSeparator];
|
||||
[s->box setBorderType:NSGrooveBorder];
|
||||
[s->box setTransparent:NO];
|
||||
[s->box setTitlePosition:NSNoTitle];
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -216,6 +216,10 @@ static uiControl *makeDataChoosersPage(void)
|
|||
uiControl(uiNewColorButton()),
|
||||
0);
|
||||
|
||||
uiBoxAppend(hbox,
|
||||
uiControl(uiNewVerticalSeparator()),
|
||||
0);
|
||||
|
||||
vbox = uiNewVerticalBox();
|
||||
uiBoxSetPadded(vbox, 1);
|
||||
uiBoxAppend(hbox, uiControl(vbox), 1);
|
||||
|
|
|
@ -47,6 +47,7 @@ static void openTestWindow(uiBox *(*mkf)(void))
|
|||
BA(uiNewColorButton());
|
||||
BA(uiNewPasswordEntry());
|
||||
BA(uiNewSearchEntry());
|
||||
BA(uiNewVerticalSeparator());
|
||||
|
||||
uiControlShow(uiControl(w));
|
||||
}
|
||||
|
|
|
@ -148,5 +148,10 @@ uiBox *makePage15(uiWindow *w)
|
|||
uiCheckboxOnToggled(checkbox, borderless, w);
|
||||
uiBoxAppend(page15, uiControl(checkbox), 0);
|
||||
|
||||
hbox = newHorizontalBox();
|
||||
uiBoxAppend(page15, uiControl(hbox), 1);
|
||||
|
||||
uiBoxAppend(hbox, uiControl(uiNewVerticalSeparator()), 0);
|
||||
|
||||
return page15;
|
||||
}
|
||||
|
|
1
ui.h
1
ui.h
|
@ -206,6 +206,7 @@ _UI_EXTERN uiProgressBar *uiNewProgressBar(void);
|
|||
typedef struct uiSeparator uiSeparator;
|
||||
#define uiSeparator(this) ((uiSeparator *) (this))
|
||||
_UI_EXTERN uiSeparator *uiNewHorizontalSeparator(void);
|
||||
_UI_EXTERN uiSeparator *uiNewVerticalSeparator(void);
|
||||
|
||||
typedef struct uiCombobox uiCombobox;
|
||||
#define uiCombobox(this) ((uiCombobox *) (this))
|
||||
|
|
|
@ -20,3 +20,15 @@ uiSeparator *uiNewHorizontalSeparator(void)
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
uiSeparator *uiNewVerticalSeparator(void)
|
||||
{
|
||||
uiSeparator *s;
|
||||
|
||||
uiUnixNewControl(uiSeparator, s);
|
||||
|
||||
s->widget = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
|
||||
s->separator = GTK_SEPARATOR(s->widget);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
struct uiSeparator {
|
||||
uiWindowsControl c;
|
||||
HWND hwnd;
|
||||
BOOL vertical;
|
||||
};
|
||||
|
||||
uiWindowsControlAllDefaults(uiSeparator)
|
||||
|
@ -15,17 +16,25 @@ uiWindowsControlAllDefaults(uiSeparator)
|
|||
// via https://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx
|
||||
#define separatorHeight 1
|
||||
|
||||
// TODO
|
||||
#define separatorWidth 1
|
||||
|
||||
static void uiSeparatorMinimumSize(uiWindowsControl *c, int *width, int *height)
|
||||
{
|
||||
uiSeparator *s = uiSeparator(c);
|
||||
uiWindowsSizing sizing;
|
||||
int y;
|
||||
int x, y;
|
||||
|
||||
*width = 1; // TODO
|
||||
*height = 1;
|
||||
x = separatorWidth;
|
||||
y = separatorHeight;
|
||||
uiWindowsGetSizing(s->hwnd, &sizing);
|
||||
uiWindowsSizingDlgUnitsToPixels(&sizing, NULL, &y);
|
||||
*height = y;
|
||||
uiWindowsSizingDlgUnitsToPixels(&sizing, &x, &y);
|
||||
if (s->vertical)
|
||||
*width = x;
|
||||
else
|
||||
*height = y;
|
||||
}
|
||||
|
||||
uiSeparator *uiNewHorizontalSeparator(void)
|
||||
|
@ -42,3 +51,19 @@ uiSeparator *uiNewHorizontalSeparator(void)
|
|||
|
||||
return s;
|
||||
}
|
||||
|
||||
uiSeparator *uiNewVerticalSeparator(void)
|
||||
{
|
||||
uiSeparator *s;
|
||||
|
||||
uiWindowsNewControl(uiSeparator, s);
|
||||
|
||||
s->hwnd = uiWindowsEnsureCreateControlHWND(0,
|
||||
L"static", L"",
|
||||
SS_ETCHEDHORZ,
|
||||
hInstance, NULL,
|
||||
TRUE);
|
||||
s->vertical = TRUE;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue