Dropped Page from uiTab method names. This keeps things consistent and allows us to do a more important change: InsertBefore -> InsertAt.
This commit is contained in:
parent
2a5cdb6662
commit
ef794a6db5
1
TODO.md
1
TODO.md
|
@ -20,7 +20,6 @@ ultimately:
|
||||||
- Windows: requires getting current menu state when amending it in sync()
|
- Windows: requires getting current menu state when amending it in sync()
|
||||||
- figure out where we should return HRESULTs
|
- figure out where we should return HRESULTs
|
||||||
- Windows: don't abort if a cleanup function fails?
|
- Windows: don't abort if a cleanup function fails?
|
||||||
- drop "Page" from uiTab method names? (uiTabAppendPage() -> uiTabAppend())
|
|
||||||
- make it so Windows API calls that do logLastError(), etc. abort whatever they're doing and not try to continue, just like wintable
|
- make it so Windows API calls that do logLastError(), etc. abort whatever they're doing and not try to continue, just like wintable
|
||||||
- 32-bit Mac OS X support (requires lots of code changes)
|
- 32-bit Mac OS X support (requires lots of code changes)
|
||||||
- change the build system to be more receptive to arch changes
|
- change the build system to be more receptive to arch changes
|
||||||
|
|
|
@ -74,16 +74,16 @@ int main(int argc, char *argv[])
|
||||||
uiBoxAppend(mainBox, uiControl(mainTab), 1);
|
uiBoxAppend(mainBox, uiControl(mainTab), 1);
|
||||||
|
|
||||||
makePage1(w);
|
makePage1(w);
|
||||||
// uiTabAppendPage(mainTab, "Page 1", uiControl(page1));
|
// uiTabAppend(mainTab, "Page 1", uiControl(page1));
|
||||||
uiWindowSetChild(w, uiControl(page1));
|
uiWindowSetChild(w, uiControl(page1));
|
||||||
|
|
||||||
page2 = makePage2();
|
page2 = makePage2();
|
||||||
uiTabAppendPage(mainTab, "Page 2", uiControl(page2));
|
uiTabAppend(mainTab, "Page 2", uiControl(page2));
|
||||||
|
|
||||||
uiTabAppendPage(mainTab, "Empty Page", uiControl(uiNewHorizontalBox()));
|
uiTabAppend(mainTab, "Empty Page", uiControl(uiNewHorizontalBox()));
|
||||||
|
|
||||||
page3 = makePage3();
|
page3 = makePage3();
|
||||||
uiTabAppendPage(mainTab, "Page 3", uiControl(page3));
|
uiTabAppend(mainTab, "Page 3", uiControl(page3));
|
||||||
|
|
||||||
uiControlShow(uiControl(w));
|
uiControlShow(uiControl(w));
|
||||||
uiMain();
|
uiMain();
|
||||||
|
|
|
@ -26,12 +26,12 @@ static void movePage1(uiButton *b, void *data)
|
||||||
{
|
{
|
||||||
if (moveBack) {
|
if (moveBack) {
|
||||||
uiBoxDelete(mainBox, 1);
|
uiBoxDelete(mainBox, 1);
|
||||||
uiTabInsertPageBefore(mainTab, "Page 1", 0, uiControl(page1));
|
uiTabInsertBefore(mainTab, "Page 1", 0, uiControl(page1));
|
||||||
uiButtonSetText(b, moveOutText);
|
uiButtonSetText(b, moveOutText);
|
||||||
moveBack = 0;
|
moveBack = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uiTabDeletePage(mainTab, 0);
|
uiTabDelete(mainTab, 0);
|
||||||
uiBoxAppend(mainBox, uiControl(page1), 1);
|
uiBoxAppend(mainBox, uiControl(page1), 1);
|
||||||
uiButtonSetText(b, moveBackText);
|
uiButtonSetText(b, moveBackText);
|
||||||
moveBack = 1;
|
moveBack = 1;
|
||||||
|
@ -156,8 +156,8 @@ uiBox *makePage2(void)
|
||||||
uiBoxAppend(page2, uiControl(hbox), 0);
|
uiBoxAppend(page2, uiControl(hbox), 0);
|
||||||
|
|
||||||
disabledTab = newTab();
|
disabledTab = newTab();
|
||||||
uiTabAppendPage(disabledTab, "Disabled", uiControl(uiNewButton("Button")));
|
uiTabAppend(disabledTab, "Disabled", uiControl(uiNewButton("Button")));
|
||||||
uiTabAppendPage(disabledTab, "Tab", uiControl(uiNewLabel("Label")));
|
uiTabAppend(disabledTab, "Tab", uiControl(uiNewLabel("Label")));
|
||||||
uiControlDisable(uiControl(disabledTab));
|
uiControlDisable(uiControl(disabledTab));
|
||||||
uiBoxAppend(page2, uiControl(disabledTab), 1);
|
uiBoxAppend(page2, uiControl(disabledTab), 1);
|
||||||
|
|
||||||
|
|
|
@ -123,9 +123,9 @@ interface Label from Control {
|
||||||
func NewLabel(text *const char) *Label;
|
func NewLabel(text *const char) *Label;
|
||||||
|
|
||||||
interface Tab from Control {
|
interface Tab from Control {
|
||||||
func AppendPage(name *const char, c *Control);
|
func Append(name *const char, c *Control);
|
||||||
func InsertPageBefore(name *const char, before uintmax_t, c *Control);
|
func InsertBefore(name *const char, before uintmax_t, c *Control);
|
||||||
func DeletePage(index uintmax_t);
|
func Delete(index uintmax_t);
|
||||||
func NumPages(void) uintmax_t;
|
func NumPages(void) uintmax_t;
|
||||||
func Margined(page uintmax_t) int;
|
func Margined(page uintmax_t) int;
|
||||||
func SetMargined(page uintmax_t, margined int);
|
func SetMargined(page uintmax_t, margined int);
|
||||||
|
|
|
@ -219,7 +219,7 @@ static LRESULT CALLBACK tabSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
|
|
||||||
#define tabCapGrow 32
|
#define tabCapGrow 32
|
||||||
|
|
||||||
static void tabAppendPage(uiTab *tt, const char *name, uiControl *child)
|
static void tabAppend(uiTab *tt, const char *name, uiControl *child)
|
||||||
{
|
{
|
||||||
struct tab *t = (struct tab *) tt;
|
struct tab *t = (struct tab *) tt;
|
||||||
TCITEMW item;
|
TCITEMW item;
|
||||||
|
@ -252,7 +252,7 @@ static void tabAppendPage(uiTab *tt, const char *name, uiControl *child)
|
||||||
uiControlQueueResize(page->control);
|
uiControlQueueResize(page->control);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tabInsertPageBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
|
static void tabInsertBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
|
||||||
{
|
{
|
||||||
struct tab *t = (struct tab *) tt;
|
struct tab *t = (struct tab *) tt;
|
||||||
TCITEMW item;
|
TCITEMW item;
|
||||||
|
@ -273,11 +273,11 @@ static void tabInsertPageBefore(uiTab *tt, const char *name, uintmax_t n, uiCont
|
||||||
wname = toUTF16(name);
|
wname = toUTF16(name);
|
||||||
item.pszText = wname;
|
item.pszText = wname;
|
||||||
if (SendMessageW(t->hwnd, TCM_INSERTITEM, (WPARAM) n, (LPARAM) (&item)) == (LRESULT) -1)
|
if (SendMessageW(t->hwnd, TCM_INSERTITEM, (WPARAM) n, (LPARAM) (&item)) == (LRESULT) -1)
|
||||||
logLastError("error adding tab to Tab in uiTabInsertPageBefore()");
|
logLastError("error adding tab to Tab in uiTabInsertBefore()");
|
||||||
uiFree(wname);
|
uiFree(wname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tabDeletePage(uiTab *tt, uintmax_t n)
|
static void tabDelete(uiTab *tt, uintmax_t n)
|
||||||
{
|
{
|
||||||
struct tab *t = (struct tab *) tt;
|
struct tab *t = (struct tab *) tt;
|
||||||
struct tabPage *page;
|
struct tabPage *page;
|
||||||
|
@ -285,7 +285,7 @@ static void tabDeletePage(uiTab *tt, uintmax_t n)
|
||||||
// first delete the tab from the tab control
|
// first delete the tab from the tab control
|
||||||
// if this is the current tab, no tab will be selected, which is good
|
// if this is the current tab, no tab will be selected, which is good
|
||||||
if (SendMessageW(t->hwnd, TCM_DELETEITEM, (WPARAM) n, 0) == FALSE)
|
if (SendMessageW(t->hwnd, TCM_DELETEITEM, (WPARAM) n, 0) == FALSE)
|
||||||
logLastError("error deleting Tab page in tabDeletePage()");
|
logLastError("error deleting Tab page in tabDelete()");
|
||||||
|
|
||||||
// now delete the page itself
|
// now delete the page itself
|
||||||
page = ptrArrayIndex(t->pages, struct tabPage *, n);
|
page = ptrArrayIndex(t->pages, struct tabPage *, n);
|
||||||
|
@ -362,9 +362,9 @@ uiTab *uiNewTab(void)
|
||||||
t->baseSysFunc = uiControl(t)->SysFunc;
|
t->baseSysFunc = uiControl(t)->SysFunc;
|
||||||
uiControl(t)->SysFunc = tabSysFunc;
|
uiControl(t)->SysFunc = tabSysFunc;
|
||||||
|
|
||||||
uiTab(t)->AppendPage = tabAppendPage;
|
uiTab(t)->Append = tabAppend;
|
||||||
uiTab(t)->InsertPageBefore = tabInsertPageBefore;
|
uiTab(t)->InsertBefore = tabInsertBefore;
|
||||||
uiTab(t)->DeletePage = tabDeletePage;
|
uiTab(t)->Delete = tabDelete;
|
||||||
uiTab(t)->NumPages = tabNumPages;
|
uiTab(t)->NumPages = tabNumPages;
|
||||||
uiTab(t)->Margined = tabMargined;
|
uiTab(t)->Margined = tabMargined;
|
||||||
uiTab(t)->SetMargined = tabSetMargined;
|
uiTab(t)->SetMargined = tabSetMargined;
|
||||||
|
|
|
@ -26,15 +26,15 @@ static void tabPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tabAppendPage(uiTab *tt, const char *name, uiControl *child)
|
static void tabAppend(uiTab *tt, const char *name, uiControl *child)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tabInsertPageBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
|
static void tabInsertBefore(uiTab *tt, const char *name, uintmax_t n, uiControl *child)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tabDeletePage(uiTab *tt, uintmax_t n)
|
static void tabDelete(uiTab *tt, uintmax_t n)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ uiTab *uiNewTab(void)
|
||||||
|
|
||||||
uiControl(t)->PreferredSize = tabPreferredSize;
|
uiControl(t)->PreferredSize = tabPreferredSize;
|
||||||
|
|
||||||
uiTab(t)->AppendPage = tabAppendPage;
|
uiTab(t)->Append = tabAppend;
|
||||||
uiTab(t)->InsertPageBefore = tabInsertPageBefore;
|
uiTab(t)->InsertBefore = tabInsertBefore;
|
||||||
uiTab(t)->DeletePage = tabDeletePage;
|
uiTab(t)->Delete = tabDelete;
|
||||||
uiTab(t)->NumPages = tabNumPages;
|
uiTab(t)->NumPages = tabNumPages;
|
||||||
uiTab(t)->Margined = tabMargined;
|
uiTab(t)->Margined = tabMargined;
|
||||||
uiTab(t)->SetMargined = tabSetMargined;
|
uiTab(t)->SetMargined = tabSetMargined;
|
||||||
|
|
Loading…
Reference in New Issue