InsertBefore -> InsertAt.
This commit is contained in:
parent
b2c0b631b7
commit
d8624c87c9
4
TODO.md
4
TODO.md
|
@ -28,9 +28,9 @@ notes to self
|
|||
- explicitly document label position at top-left corner
|
||||
- mark that uiControlShow() on a uiWindow() will bring to front and give keyboard focus because of OS X
|
||||
- make sure ShowWindow() is sufficient for zorder on Windows
|
||||
- document that you CAN use InsertBefore functions to insert at the first invalid index, even if the array is empty
|
||||
- document that you CAN use InsertAt functions to insert at the first invalid index, even if the array is empty
|
||||
- add tests for this
|
||||
- note that uiTabInsertPageBefore() does NOT change the current tab page (it may change its index if inserting before the current page)
|
||||
- note that uiTabInsertAt() does NOT change the current tab page (it may change its index if inserting before the current page)
|
||||
- note that the default action for uiWindowOnClosing() is to return 0 (keep the window open)
|
||||
- note that uiInitOptions should be initialized to zero
|
||||
- explicitly document that uiCheckboxSetChecked() and uiEntrySetText() do not fire uiCheckboxOnToggled() and uiEntryOnChanged(), respectively
|
||||
|
|
|
@ -21,13 +21,13 @@ void ptrArrayDestroy(struct ptrArray *p)
|
|||
|
||||
void ptrArrayAppend(struct ptrArray *p, void *d)
|
||||
{
|
||||
ptrArrayInsertBefore(p, p->len, d);
|
||||
ptrArrayInsertAt(p, p->len, d);
|
||||
}
|
||||
|
||||
void ptrArrayInsertBefore(struct ptrArray *p, uintmax_t i, void *d)
|
||||
void ptrArrayInsertAt(struct ptrArray *p, uintmax_t i, void *d)
|
||||
{
|
||||
if (i > p->len)
|
||||
complain("index out of range in ptrArrayInsertBefore()");
|
||||
complain("index out of range in ptrArrayInsertAt()");
|
||||
if (p->len >= p->cap) {
|
||||
p->cap += grow;
|
||||
p->ptrs = (void **) uiRealloc(p->ptrs, p->cap * sizeof (void *), "void *[]");
|
||||
|
|
|
@ -26,7 +26,7 @@ static void movePage1(uiButton *b, void *data)
|
|||
{
|
||||
if (moveBack) {
|
||||
uiBoxDelete(mainBox, 1);
|
||||
uiTabInsertBefore(mainTab, "Page 1", 0, uiControl(page1));
|
||||
uiTabInsertAt(mainTab, "Page 1", 0, uiControl(page1));
|
||||
uiButtonSetText(b, moveOutText);
|
||||
moveBack = 0;
|
||||
return;
|
||||
|
|
|
@ -124,7 +124,7 @@ func NewLabel(text *const char) *Label;
|
|||
|
||||
interface Tab from Control {
|
||||
func Append(name *const char, c *Control);
|
||||
func InsertBefore(name *const char, before uintmax_t, c *Control);
|
||||
func InsertAt(name *const char, before uintmax_t, c *Control);
|
||||
func Delete(index uintmax_t);
|
||||
func NumPages(void) uintmax_t;
|
||||
func Margined(page uintmax_t) int;
|
||||
|
|
|
@ -19,7 +19,7 @@ struct ptrArray {
|
|||
struct ptrArray *newPtrArray(void);
|
||||
void ptrArrayDestroy(struct ptrArray *);
|
||||
void ptrArrayAppend(struct ptrArray *, void *);
|
||||
void ptrArrayInsertBefore(struct ptrArray *, uintmax_t, void *);
|
||||
void ptrArrayInsertAt(struct ptrArray *, uintmax_t, void *);
|
||||
void ptrArrayDelete(struct ptrArray *, uintmax_t);
|
||||
#define ptrArrayIndex(p, T, i) ((T) ((p)->ptrs[(i)]))
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ static void tabAppend(uiTab *tt, const char *name, uiControl *child)
|
|||
uiControlQueueResize(page->control);
|
||||
}
|
||||
|
||||
static void tabInsertBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
|
||||
static void tabInsertAt(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
|
||||
{
|
||||
struct tab *t = (struct tab *) tt;
|
||||
TCITEMW item;
|
||||
|
@ -266,14 +266,14 @@ static void tabInsertBefore(uiTab *tt, const char *name, uintmax_t n, uiControl
|
|||
// always hide; the current tab doesn't change
|
||||
uiControlHide(page->control);
|
||||
|
||||
ptrArrayInsertBefore(t->pages, n, page);
|
||||
ptrArrayInsertAt(t->pages, n, page);
|
||||
|
||||
ZeroMemory(&item, sizeof (TCITEMW));
|
||||
item.mask = TCIF_TEXT;
|
||||
wname = toUTF16(name);
|
||||
item.pszText = wname;
|
||||
if (SendMessageW(t->hwnd, TCM_INSERTITEM, (WPARAM) n, (LPARAM) (&item)) == (LRESULT) -1)
|
||||
logLastError("error adding tab to Tab in uiTabInsertBefore()");
|
||||
logLastError("error adding tab to Tab in uiTabInsertAt()");
|
||||
uiFree(wname);
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ uiTab *uiNewTab(void)
|
|||
uiControl(t)->SysFunc = tabSysFunc;
|
||||
|
||||
uiTab(t)->Append = tabAppend;
|
||||
uiTab(t)->InsertBefore = tabInsertBefore;
|
||||
uiTab(t)->InsertAt = tabInsertAt;
|
||||
uiTab(t)->Delete = tabDelete;
|
||||
uiTab(t)->NumPages = tabNumPages;
|
||||
uiTab(t)->Margined = tabMargined;
|
||||
|
|
|
@ -30,7 +30,7 @@ static void tabAppend(uiTab *tt, const char *name, uiControl *child)
|
|||
{
|
||||
}
|
||||
|
||||
static void tabInsertBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
|
||||
static void tabInsertAt(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ uiTab *uiNewTab(void)
|
|||
uiControl(t)->PreferredSize = tabPreferredSize;
|
||||
|
||||
uiTab(t)->Append = tabAppend;
|
||||
uiTab(t)->InsertBefore = tabInsertBefore;
|
||||
uiTab(t)->InsertAt = tabInsertAt;
|
||||
uiTab(t)->Delete = tabDelete;
|
||||
uiTab(t)->NumPages = tabNumPages;
|
||||
uiTab(t)->Margined = tabMargined;
|
||||
|
|
Loading…
Reference in New Issue