uiButton work. No event ties yet.
This commit is contained in:
parent
6719275576
commit
278c973ae5
|
@ -127,6 +127,8 @@ static uiBox *finishNewBox(orientation o)
|
|||
|
||||
b->layout = new BGroupLayout(o, 0);
|
||||
b->view = new BView(NULL, B_SUPPORTS_LAYOUT, b->layout);
|
||||
// TODO is this really necessary? is it correct?
|
||||
b->view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
b->vertical = o == B_VERTICAL;
|
||||
|
||||
|
|
|
@ -3,29 +3,38 @@
|
|||
|
||||
struct uiButton {
|
||||
uiHaikuControl c;
|
||||
BStringView *dummy;
|
||||
BButton *button;
|
||||
void (*onClicked)(uiButton *, void *);
|
||||
void *onClickedData;
|
||||
};
|
||||
|
||||
uiHaikuDefineControl(
|
||||
uiButton, // type name
|
||||
uiButtonType, // type function
|
||||
dummy // handle
|
||||
button // handle
|
||||
)
|
||||
|
||||
#define mButtonClicked 0x4E754E75
|
||||
|
||||
static void defaultOnClicked(uiButton *b, void *data)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
char *uiButtonText(uiButton *b)
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
return uiHaikuStrdupText(b->button->Label());
|
||||
}
|
||||
|
||||
void uiButtonSetText(uiButton *b, const char *text)
|
||||
{
|
||||
// TODO
|
||||
b->button->SetLabel(text);
|
||||
}
|
||||
|
||||
void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *b, void *data), void *data)
|
||||
{
|
||||
// TODO
|
||||
b->onClicked = f;
|
||||
b->onClickedData = data;
|
||||
}
|
||||
|
||||
uiButton *uiNewButton(const char *text)
|
||||
|
@ -34,8 +43,10 @@ uiButton *uiNewButton(const char *text)
|
|||
|
||||
b = (uiButton *) uiNewControl(uiButtonType());
|
||||
|
||||
b->dummy = new BStringView(BRect(0, 0, 1, 1), NULL,
|
||||
"TODO uiButton not implemented");
|
||||
b->button = new BButton(text, new BMessage(mButtonClicked));
|
||||
|
||||
// TODO hook up events
|
||||
uiButtonOnClicked(b, defaultOnClicked, NULL);
|
||||
|
||||
uiHaikuFinishNewControl(b, uiButton);
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ void uiTabInsertAt(uiTab *t, const char *name, uintmax_t before, uiControl *c)
|
|||
|
||||
p.view = new BView(BRect(0, 0, 1, 1), NULL,
|
||||
B_FOLLOW_ALL_SIDES, 0);
|
||||
// TODO needed?
|
||||
p.view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
p.tab = new BTab(p.view);
|
||||
p.child = newSingleChild(c, uiControl(t), attach, p.view);
|
||||
|
||||
|
|
Loading…
Reference in New Issue