Started non-wrapping multiline entries. Implemented on Windows.

This commit is contained in:
Pietro Gagliardi 2016-05-22 13:56:36 -04:00
parent f3dad94039
commit 313ce47833
6 changed files with 35 additions and 6 deletions

View File

@ -18,6 +18,7 @@ CFILES += \
test/page9.c \ test/page9.c \
test/page10.c \ test/page10.c \
test/page11.c \ test/page11.c \
test/page12.c \
test/spaced.c test/spaced.c
HFILES += \ HFILES += \

View File

@ -47,7 +47,7 @@ int main(int argc, char *argv[])
uiWindow *w; uiWindow *w;
uiBox *page2, *page3, *page4, *page5; uiBox *page2, *page3, *page4, *page5;
uiBox *page6, *page7, *page8, *page9, *page10; uiBox *page6, *page7, *page8, *page9, *page10;
uiBox *page11; uiBox *page11, *page12;
uiTab *outerTab; uiTab *outerTab;
uiTab *innerTab; uiTab *innerTab;
int nomenus = 0; int nomenus = 0;
@ -138,6 +138,9 @@ int main(int argc, char *argv[])
// page11 = makePage11(); // page11 = makePage11();
// uiTabAppend(innerTab, "Page 11", uiControl(page11)); // uiTabAppend(innerTab, "Page 11", uiControl(page11));
page12 = makePage12();
uiTabAppend(innerTab, "Page 12", uiControl(page12));
if (startspaced) if (startspaced)
setSpaced(1); setSpaced(1);

14
test/page12.c Normal file
View File

@ -0,0 +1,14 @@
// 22 may 2016
#include "test.h"
uiBox *makePage12(void)
{
uiBox *page12;
page12 = newHorizontalBox();
uiBoxAppend(page12, uiControl(uiNewMultilineEntry()), 1);
uiBoxAppend(page12, uiControl(uiNewNonWrappingMultilineEntry()), 1);
return page12;
}

View File

@ -74,3 +74,6 @@ extern uiBox *makePage10(void);
// page11.c // page11.c
extern uiBox *makePage11(void); extern uiBox *makePage11(void);
// page12.c
extern uiBox *makePage12(void);

4
ui.h
View File

@ -202,9 +202,6 @@ _UI_EXTERN uiDateTimePicker *uiNewDateTimePicker(void);
_UI_EXTERN uiDateTimePicker *uiNewDatePicker(void); _UI_EXTERN uiDateTimePicker *uiNewDatePicker(void);
_UI_EXTERN uiDateTimePicker *uiNewTimePicker(void); _UI_EXTERN uiDateTimePicker *uiNewTimePicker(void);
// TODO merge with uiEntry? some things can't be shared (for instance, the future Invalid()
// TODO how are line endings converted?
// TODO provide a facility for allowing horizontal scrolling
// TODO provide a facility for entering tab stops? // TODO provide a facility for entering tab stops?
typedef struct uiMultilineEntry uiMultilineEntry; typedef struct uiMultilineEntry uiMultilineEntry;
#define uiMultilineEntry(this) ((uiMultilineEntry *) (this)) #define uiMultilineEntry(this) ((uiMultilineEntry *) (this))
@ -215,6 +212,7 @@ _UI_EXTERN void uiMultilineEntryOnChanged(uiMultilineEntry *e, void (*f)(uiMulti
_UI_EXTERN int uiMultilineEntryReadOnly(uiMultilineEntry *e); _UI_EXTERN int uiMultilineEntryReadOnly(uiMultilineEntry *e);
_UI_EXTERN void uiMultilineEntrySetReadOnly(uiMultilineEntry *e, int readonly); _UI_EXTERN void uiMultilineEntrySetReadOnly(uiMultilineEntry *e, int readonly);
_UI_EXTERN uiMultilineEntry *uiNewMultilineEntry(void); _UI_EXTERN uiMultilineEntry *uiNewMultilineEntry(void);
_UI_EXTERN uiMultilineEntry *uiNewNonWrappingMultilineEntry(void);
typedef struct uiMenuItem uiMenuItem; typedef struct uiMenuItem uiMenuItem;
#define uiMenuItem(this) ((uiMenuItem *) (this)) #define uiMenuItem(this) ((uiMenuItem *) (this))

View File

@ -126,7 +126,7 @@ void uiMultilineEntrySetReadOnly(uiMultilineEntry *e, int readonly)
logLastError(L"error making uiMultilineEntry read-only"); logLastError(L"error making uiMultilineEntry read-only");
} }
uiMultilineEntry *uiNewMultilineEntry(void) static uiMultilineEntry *finishMultilineEntry(DWORD style)
{ {
uiMultilineEntry *e; uiMultilineEntry *e;
@ -134,7 +134,7 @@ uiMultilineEntry *uiNewMultilineEntry(void)
e->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE, e->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
L"edit", L"", L"edit", L"",
ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL | ES_WANTRETURN | WS_TABSTOP | WS_VSCROLL, ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL | ES_WANTRETURN | WS_TABSTOP | WS_VSCROLL | style,
hInstance, NULL, hInstance, NULL,
TRUE); TRUE);
@ -143,3 +143,13 @@ uiMultilineEntry *uiNewMultilineEntry(void)
return e; return e;
} }
uiMultilineEntry *uiNewMultilineEntry(void)
{
return finishMultilineEntry(0);
}
uiMultilineEntry *uiNewNonWrappingMultilineEntry(void)
{
return finishMultilineEntry(WS_HSCROLL | ES_AUTOHSCROLL);
}