2015-04-08 22:43:01 -05:00
|
|
|
// 8 april 2015
|
|
|
|
#include "uipriv_windows.h"
|
|
|
|
|
|
|
|
struct entry {
|
2015-04-16 08:20:00 -05:00
|
|
|
uiEntry e;
|
2015-04-17 10:13:42 -05:00
|
|
|
HWND hwnd;
|
2015-04-08 22:43:01 -05:00
|
|
|
};
|
|
|
|
|
2015-04-09 17:54:14 -05:00
|
|
|
static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult)
|
2015-04-08 22:43:01 -05:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-04-09 18:07:41 -05:00
|
|
|
static BOOL onWM_NOTIFY(uiControl *c, NMHDR *nm, LRESULT *lResult)
|
2015-04-08 22:43:01 -05:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-04-18 17:02:16 -05:00
|
|
|
static void onDestroy(void *data)
|
2015-04-08 22:43:01 -05:00
|
|
|
{
|
2015-04-18 17:02:16 -05:00
|
|
|
struct entry *e = (struct entry *) data;
|
2015-04-08 22:43:01 -05:00
|
|
|
|
|
|
|
uiFree(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
// from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
|
|
|
|
#define entryWidth 107 /* this is actually the shorter progress bar width, but Microsoft only indicates as wide as necessary */
|
|
|
|
#define entryHeight 14
|
|
|
|
|
2015-04-09 16:46:26 -05:00
|
|
|
static void preferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height)
|
2015-04-08 22:43:01 -05:00
|
|
|
{
|
2015-04-09 17:45:58 -05:00
|
|
|
*width = uiDlgUnitsToX(entryWidth, d->sys->baseX);
|
|
|
|
*height = uiDlgUnitsToY(entryHeight, d->sys->baseY);
|
2015-04-08 22:43:01 -05:00
|
|
|
}
|
|
|
|
|
2015-04-17 10:13:42 -05:00
|
|
|
static char *entryText(uiEntry *e)
|
2015-04-16 08:20:00 -05:00
|
|
|
{
|
|
|
|
return uiWindowsControlText(uiControl(e));
|
|
|
|
}
|
|
|
|
|
2015-04-17 10:13:42 -05:00
|
|
|
static void entrySetText(uiEntry *e, const char *text)
|
2015-04-16 08:20:00 -05:00
|
|
|
{
|
|
|
|
uiWindowsControlSetText(uiControl(e), text);
|
|
|
|
}
|
|
|
|
|
2015-04-16 08:33:21 -05:00
|
|
|
uiEntry *uiNewEntry(void)
|
2015-04-08 22:43:01 -05:00
|
|
|
{
|
|
|
|
struct entry *e;
|
2015-05-02 19:51:00 -05:00
|
|
|
uiWindowsMakeControlParams p;
|
2015-04-08 22:43:01 -05:00
|
|
|
|
2015-04-16 08:20:00 -05:00
|
|
|
e = uiNew(struct entry);
|
|
|
|
|
2015-04-08 22:43:01 -05:00
|
|
|
p.dwExStyle = WS_EX_CLIENTEDGE;
|
|
|
|
p.lpClassName = L"edit";
|
|
|
|
p.lpWindowName = L"";
|
2015-04-10 16:53:59 -05:00
|
|
|
p.dwStyle = ES_AUTOHSCROLL | ES_LEFT | ES_NOHIDESEL | WS_TABSTOP;
|
2015-04-08 22:43:01 -05:00
|
|
|
p.hInstance = hInstance;
|
2015-04-10 16:53:59 -05:00
|
|
|
p.useStandardControlFont = TRUE;
|
2015-04-08 22:43:01 -05:00
|
|
|
p.onWM_COMMAND = onWM_COMMAND;
|
|
|
|
p.onWM_NOTIFY = onWM_NOTIFY;
|
2015-04-18 17:02:16 -05:00
|
|
|
p.onDestroy = onDestroy;
|
|
|
|
p.onDestroyData = e;
|
2015-05-02 19:51:00 -05:00
|
|
|
uiWindowsMakeControl(uiControl(e), &p);
|
2015-04-09 16:46:26 -05:00
|
|
|
|
2015-04-29 09:46:09 -05:00
|
|
|
e->hwnd = (HWND) uiControlHandle(uiControl(e));
|
2015-04-17 10:13:42 -05:00
|
|
|
|
2015-04-16 08:20:00 -05:00
|
|
|
uiControl(e)->PreferredSize = preferredSize;
|
2015-04-08 22:43:01 -05:00
|
|
|
|
2015-04-17 10:13:42 -05:00
|
|
|
uiEntry(e)->Text = entryText;
|
|
|
|
uiEntry(e)->SetText = entrySetText;
|
2015-04-09 10:12:01 -05:00
|
|
|
|
2015-04-16 08:20:00 -05:00
|
|
|
return uiEntry(e);
|
2015-04-09 10:12:01 -05:00
|
|
|
}
|