libui/winforms/label.cpp

48 lines
902 B
C++
Raw Normal View History

2015-11-26 12:55:39 -06:00
// 26 november 2015
#include "uipriv_winforms.hpp"
2015-11-26 12:55:39 -06:00
// TODO alignment
// TODO lots of padding
2015-11-26 15:42:32 -06:00
// TODO Label also has mnemonic value; use TextField instead
2015-11-26 12:55:39 -06:00
struct uiLabel {
uiWindowsControl c;
gcroot<Label ^> *label;
};
uiWindowsDefineControl(
uiLabel, // type name
uiLabelType, // type function
label // handle
)
char *uiLabelText(uiLabel *l)
{
String ^text;
// TOOD bad cast?
text = (String ^) ((*(l->label))->Content);
return uiWindowsCLRStringToText(text);
}
void uiLabelSetText(uiLabel *l, const char *text)
{
(*(l->label))->Content = fromUTF8(text);
// TODO does this adjust the layout?
}
uiLabel *uiNewLabel(const char *text)
{
uiLabel *l;
l = (uiLabel *) uiNewControl(uiLabelType());
l->label = new gcroot<Label ^>();
*(l->label) = gcnew Label();
(*(l->label))->Content = fromUTF8(text);
uiWindowsFinishNewControl(l, uiLabel, label);
return l;
}