2015-11-19 07:47:53 -06:00
|
|
|
// 18 november 2015
|
|
|
|
#include "uipriv_haiku.hpp"
|
|
|
|
|
|
|
|
struct uiEntry {
|
|
|
|
uiHaikuControl c;
|
2015-11-19 16:26:40 -06:00
|
|
|
BTextControl *tc;
|
|
|
|
void (*onChanged)(uiEntry *, void *);
|
|
|
|
void *onChangedData;
|
2015-11-19 07:47:53 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
uiHaikuDefineControl(
|
|
|
|
uiEntry, // type name
|
|
|
|
uiEntryType, // type function
|
2015-11-19 16:26:40 -06:00
|
|
|
tc // handle
|
2015-11-19 07:47:53 -06:00
|
|
|
)
|
|
|
|
|
2015-11-19 16:26:40 -06:00
|
|
|
#define mEntryChanged 0x60FE60FE
|
|
|
|
|
|
|
|
static void defaultOnChanged(uiEntry *e, void *data)
|
|
|
|
{
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
2015-11-19 07:47:53 -06:00
|
|
|
char *uiEntryText(uiEntry *e)
|
|
|
|
{
|
2015-11-19 16:26:40 -06:00
|
|
|
return uiHaikuStrdupText(e->tc->Text());
|
2015-11-19 07:47:53 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void uiEntrySetText(uiEntry *e, const char *text)
|
|
|
|
{
|
2015-11-19 16:26:40 -06:00
|
|
|
// TODO does this send a message?
|
|
|
|
e->tc->SetText(text);
|
2015-11-19 07:47:53 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *e, void *data), void *data)
|
|
|
|
{
|
2015-11-19 16:26:40 -06:00
|
|
|
e->onChanged = f;
|
|
|
|
e->onChangedData = data;
|
2015-11-19 07:47:53 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
int uiEntryReadOnly(uiEntry *e)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void uiEntrySetReadOnly(uiEntry *e, int readonly)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
uiEntry *uiNewEntry(void)
|
|
|
|
{
|
|
|
|
uiEntry *e;
|
|
|
|
|
|
|
|
e = (uiEntry *) uiNewControl(uiEntryType());
|
|
|
|
|
2015-11-19 16:26:40 -06:00
|
|
|
e->tc = new BTextControl(NULL, "", new BMessage(mEntryChanged));
|
|
|
|
|
|
|
|
uiEntryOnChanged(e, defaultOnChanged, NULL);
|
2015-11-19 07:47:53 -06:00
|
|
|
|
|
|
|
uiHaikuFinishNewControl(e, uiEntry);
|
|
|
|
|
|
|
|
return e;
|
|
|
|
}
|