From 42b0bada64ff1276a62a2ceff37d1ffa69277f6f Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 26 Nov 2015 18:27:23 -0500 Subject: [PATCH] Stubbed everything else. It works! --- wpf/area.cpp | 39 +++++++++++ wpf/combobox.cpp | 60 ++++++++++++++++ wpf/datetimepicker.cpp | 41 +++++++++++ wpf/draw.cpp | 151 +++++++++++++++++++++++++++++++++++++++++ wpf/entry.cpp | 63 +++++++++++++++++ wpf/group.cpp | 53 +++++++++++++++ wpf/libui.msbuild | 13 ++++ wpf/menu.cpp | 69 +++++++++++++++++++ wpf/progressbar.cpp | 31 +++++++++ wpf/radiobuttons.cpp | 31 +++++++++ wpf/separator.cpp | 26 +++++++ wpf/slider.cpp | 52 ++++++++++++++ wpf/spinbox.cpp | 42 ++++++++++++ wpf/stddialogs.cpp | 24 +++++++ wpf/tab.cpp | 1 + wpf/uipriv_wpf.hpp | 11 +++ 16 files changed, 707 insertions(+) create mode 100644 wpf/area.cpp create mode 100644 wpf/combobox.cpp create mode 100644 wpf/datetimepicker.cpp create mode 100644 wpf/draw.cpp create mode 100644 wpf/entry.cpp create mode 100644 wpf/group.cpp create mode 100644 wpf/menu.cpp create mode 100644 wpf/progressbar.cpp create mode 100644 wpf/radiobuttons.cpp create mode 100644 wpf/separator.cpp create mode 100644 wpf/slider.cpp create mode 100644 wpf/spinbox.cpp create mode 100644 wpf/stddialogs.cpp diff --git a/wpf/area.cpp b/wpf/area.cpp new file mode 100644 index 00000000..9a4d2484 --- /dev/null +++ b/wpf/area.cpp @@ -0,0 +1,39 @@ +// 26 november 2015 +#include "uipriv_wpf.hpp" + +struct uiArea { + uiWindowsControl c; + DUMMY dummy; + uiAreaHandler *ah; +}; + +uiWindowsDefineControl( + uiArea, // type name + uiAreaType, // type function + dummy // handle +) + +void uiAreaUpdateScroll(uiArea *a) +{ + // TODO +} + +void uiAreaQueueRedrawAll(uiArea *a) +{ + // TODO +} + +uiArea *uiNewArea(uiAreaHandler *ah) +{ + uiArea *a; + + a = (uiArea *) uiNewControl(uiAreaType()); + + a->ah = ah; + + a->dummy = mkdummy(L"uiArea"); + + uiWindowsFinishNewControl(a, uiArea, dummy); + + return a; +} diff --git a/wpf/combobox.cpp b/wpf/combobox.cpp new file mode 100644 index 00000000..02d41dc1 --- /dev/null +++ b/wpf/combobox.cpp @@ -0,0 +1,60 @@ +// 26 november 2015 +#include "uipriv_wpf.hpp" + +struct uiCombobox { + uiWindowsControl c; + DUMMY dummy; +}; + +uiWindowsDefineControl( + uiCombobox, // type name + uiComboboxType, // type function + dummy // handle +) + +void uiComboboxAppend(uiCombobox *c, const char *text) +{ + // TODO +} + +intmax_t uiComboboxSelected(uiCombobox *c) +{ + // TODO + // return 0 so the area test can work + return 0; +} + +void uiComboboxSetSelected(uiCombobox *c, intmax_t n) +{ + // TODO +} + +void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data) +{ + // TODO +} + +static uiCombobox *finishNewCombobox(bool editable) +{ + uiCombobox *c; + + c = (uiCombobox *) uiNewControl(uiComboboxType()); + + c->dummy = mkdummy(L"uiCombobox"); + +// (*(c->combobox))->IsReadOnly = editable; + + uiWindowsFinishNewControl(c, uiCombobox, dummy); + + return c; +} + +uiCombobox *uiNewCombobox(void) +{ + return finishNewCombobox(true); +} + +uiCombobox *uiNewEditableCombobox(void) +{ + return finishNewCombobox(false); +} diff --git a/wpf/datetimepicker.cpp b/wpf/datetimepicker.cpp new file mode 100644 index 00000000..3b8428f4 --- /dev/null +++ b/wpf/datetimepicker.cpp @@ -0,0 +1,41 @@ +// 26 november 2015 +#include "uipriv_wpf.hpp" + +struct uiDateTimePicker { + uiWindowsControl c; + DUMMY dummy; +}; + +uiWindowsDefineControl( + uiDateTimePicker, // type name + uiDateTimePickerType, // type function + dummy // handle +) + +static uiDateTimePicker *finishNewDateTimePicker(void) +{ + uiDateTimePicker *d; + + d = (uiDateTimePicker *) uiNewControl(uiDateTimePickerType()); + + d->dummy = mkdummy(L"uiDateTimePicker"); + + uiWindowsFinishNewControl(d, uiDateTimePicker, dummy); + + return d; +} + +uiDateTimePicker *uiNewDateTimePicker(void) +{ + return finishNewDateTimePicker(); +} + +uiDateTimePicker *uiNewDatePicker(void) +{ + return finishNewDateTimePicker(); +} + +uiDateTimePicker *uiNewTimePicker(void) +{ + return finishNewDateTimePicker(); +} diff --git a/wpf/draw.cpp b/wpf/draw.cpp new file mode 100644 index 00000000..87160762 --- /dev/null +++ b/wpf/draw.cpp @@ -0,0 +1,151 @@ +// 19 november 2015 +#include "uipriv_wpf.hpp" + +uiDrawPath *uiDrawNewPath(uiDrawFillMode fillMode) +{ + // TODO + return NULL; +} + +void uiDrawFreePath(uiDrawPath *p) +{ + // TODO +} + +void uiDrawPathNewFigure(uiDrawPath *p, double x, double y) +{ + // TODO +} + +void uiDrawPathNewFigureWithArc(uiDrawPath *p, double xCenter, double yCenter, double radius, double startAngle, double sweep, int negative) +{ + // TODO +} + +void uiDrawPathLineTo(uiDrawPath *p, double x, double y) +{ + // TODO +} + +void uiDrawPathArcTo(uiDrawPath *p, double xCenter, double yCenter, double radius, double startAngle, double sweep, int negative) +{ + // TODO +} + +void uiDrawPathBezierTo(uiDrawPath *p, double c1x, double c1y, double c2x, double c2y, double endX, double endY) +{ + // TODO +} + +void uiDrawPathCloseFigure(uiDrawPath *p) +{ + // TODO +} + +void uiDrawPathAddRectangle(uiDrawPath *p, double x, double y, double width, double height) +{ + // TODO +} + +void uiDrawPathEnd(uiDrawPath *p) +{ + // TODO +} + +struct uiDrawContext { + int TODO; +}; + +uiDrawContext *newContext(/* TODO */) +{ + // TODO + return NULL; +} + +void freeContext(uiDrawContext *c) +{ + uiFree(c); +} + +void uiDrawStroke(uiDrawContext *c, uiDrawPath *path, uiDrawBrush *b, uiDrawStrokeParams *p) +{ + // TODO +} + +void uiDrawFill(uiDrawContext *c, uiDrawPath *path, uiDrawBrush *b) +{ + // TODO +} + +void uiDrawMatrixSetIdentity(uiDrawMatrix *m) +{ + setIdentity(m); +} + +void uiDrawMatrixTranslate(uiDrawMatrix *m, double x, double y) +{ + // TODO +} + +void uiDrawMatrixScale(uiDrawMatrix *m, double xCenter, double yCenter, double x, double y) +{ + // TODO +} + +void uiDrawMatrixRotate(uiDrawMatrix *m, double x, double y, double amount) +{ + // TODO +} + +void uiDrawMatrixSkew(uiDrawMatrix *m, double x, double y, double xamount, double yamount) +{ + // TODO +} + +void uiDrawMatrixMultiply(uiDrawMatrix *dest, uiDrawMatrix *src) +{ + // TODO +} + +int uiDrawMatrixInvertible(uiDrawMatrix *m) +{ + // TODO + return 0; +} + +int uiDrawMatrixInvert(uiDrawMatrix *m) +{ + // TODO + return 0; +} + +void uiDrawMatrixTransformPoint(uiDrawMatrix *m, double *x, double *y) +{ + // TODO +} + +void uiDrawMatrixTransformSize(uiDrawMatrix *m, double *x, double *y) +{ + // TODO +} + +void uiDrawTransform(uiDrawContext *c, uiDrawMatrix *m) +{ + // TODO +} + +// TODO not documented on api.haiku-os.org +void uiDrawClip(uiDrawContext *c, uiDrawPath *path) +{ + // TODO +} + +void uiDrawSave(uiDrawContext *c) +{ + // TODO +} + +void uiDrawRestore(uiDrawContext *c) +{ + // TODO +} diff --git a/wpf/entry.cpp b/wpf/entry.cpp new file mode 100644 index 00000000..023a8603 --- /dev/null +++ b/wpf/entry.cpp @@ -0,0 +1,63 @@ +// 26 november 2015 +#include "uipriv_wpf.hpp" + +struct uiEntry { + uiWindowsControl c; + DUMMY dummy; + void (*onChanged)(uiEntry *, void *); + void *onChangedData; +}; + +uiWindowsDefineControl( + uiEntry, // type name + uiEntryType, // type function + dummy // handle +) + +static void defaultOnChanged(uiEntry *e, void *data) +{ + // do nothing +} + +char *uiEntryText(uiEntry *e) +{ + // TODO + return NULL; +} + +void uiEntrySetText(uiEntry *e, const char *text) +{ + // TODO +} + +void uiEntryOnChanged(uiEntry *e, void (*f)(uiEntry *e, void *data), void *data) +{ + e->onChanged = f; + e->onChangedData = data; +} + +int uiEntryReadOnly(uiEntry *e) +{ + // TODO + return 0; +} + +void uiEntrySetReadOnly(uiEntry *e, int readonly) +{ + // TODO +} + +uiEntry *uiNewEntry(void) +{ + uiEntry *e; + + e = (uiEntry *) uiNewControl(uiEntryType()); + + e->dummy = mkdummy("uiEntry"); + + uiEntryOnChanged(e, defaultOnChanged, NULL); + + uiWindowsFinishNewControl(e, uiEntry, dummy); + + return e; +} diff --git a/wpf/group.cpp b/wpf/group.cpp new file mode 100644 index 00000000..c5cb4df3 --- /dev/null +++ b/wpf/group.cpp @@ -0,0 +1,53 @@ +// 18 november 2015 +#include "uipriv_wpf.hpp" + +struct uiGroup { + uiWindowsControl c; + DUMMY dummy; +}; + +uiWindowsDefineControl( + uiGroup, // type name + uiGroupType, // type function + dummy // handle +) + +char *uiGroupTitle(uiGroup *g) +{ + // TODO + return NULL; +} + +void uiGroupSetTitle(uiGroup *g, const char *title) +{ + // TODO +} + +void uiGroupSetChild(uiGroup *g, uiControl *c) +{ + // TODO +} + +int uiGroupMargined(uiGroup *g) +{ + // TODO + return 0; +} + +void uiGroupSetMargined(uiGroup *g, int margined) +{ + // TODO +} + +uiGroup *uiNewGroup(const char *title) +{ + uiGroup *g; + + g = (uiGroup *) uiNewControl(uiGroupType()); + + g->dummy = mkdummy(L"uiGroup"); + + uiWindowsFinishNewControl(g, uiGroup, dummy); + + return g; +} diff --git a/wpf/libui.msbuild b/wpf/libui.msbuild index ef0d0d13..d1ac0571 100755 --- a/wpf/libui.msbuild +++ b/wpf/libui.msbuild @@ -75,18 +75,31 @@ false + + + false + + + false + + + + + + + diff --git a/wpf/menu.cpp b/wpf/menu.cpp new file mode 100644 index 00000000..06fdcd9b --- /dev/null +++ b/wpf/menu.cpp @@ -0,0 +1,69 @@ +// 19 november 2015 +#include "uipriv_wpf.hpp" + +void uiMenuItemEnable(uiMenuItem *m) +{ + // TODO +} + +void uiMenuItemDisable(uiMenuItem *m) +{ + // TODO +} + +void uiMenuItemOnClicked(uiMenuItem *m, void (*f)(uiMenuItem *sender, uiWindow *window, void *data), void *data) +{ + // TODO +} + +int uiMenuItemChecked(uiMenuItem *m) +{ + // TODO + return 0; +} + +void uiMenuItemSetChecked(uiMenuItem *m, int checked) +{ + // TODO +} + +uiMenuItem *uiMenuAppendItem(uiMenu *m, const char *name) +{ + // TODO + return NULL; +} + +uiMenuItem *uiMenuAppendCheckItem(uiMenu *m, const char *name) +{ + // TODO + return NULL; +} + +uiMenuItem *uiMenuAppendQuitItem(uiMenu *m) +{ + // TODO + return NULL; +} + +uiMenuItem *uiMenuAppendPreferencesItem(uiMenu *m) +{ + // TODO + return NULL; +} + +uiMenuItem *uiMenuAppendAboutItem(uiMenu *m) +{ + // TODO + return NULL; +} + +void uiMenuAppendSeparator(uiMenu *m) +{ + // TODO +} + +uiMenu *uiNewMenu(const char *name) +{ + // TODO + return NULL; +} diff --git a/wpf/progressbar.cpp b/wpf/progressbar.cpp new file mode 100644 index 00000000..5bc8df87 --- /dev/null +++ b/wpf/progressbar.cpp @@ -0,0 +1,31 @@ +// 26 november 2015 +#include "uipriv_wpf.hpp" + +struct uiProgressBar { + uiWindowsControl c; + DUMMY dummy; +}; + +uiWindowsDefineControl( + uiProgressBar, // type name + uiProgressBarType, // type function + dummy // handle +) + +void uiProgressBarSetValue(uiProgressBar *p, int n) +{ + // TODO +} + +uiProgressBar *uiNewProgressBar(void) +{ + uiProgressBar *p; + + p = (uiProgressBar *) uiNewControl(uiProgressBarType()); + + p->dummy = mkdummy(L"uiProgressBar"); + + uiWindowsFinishNewControl(p, uiProgressBar, dummy); + + return p; +} diff --git a/wpf/radiobuttons.cpp b/wpf/radiobuttons.cpp new file mode 100644 index 00000000..8277b9c9 --- /dev/null +++ b/wpf/radiobuttons.cpp @@ -0,0 +1,31 @@ +// 26 november 2015 +#include "uipriv_wpf.hpp" + +struct uiRadioButtons { + uiWindowsControl c; + DUMMY dummy; +}; + +uiWindowsDefineControl( + uiRadioButtons, // type name + uiRadioButtonsType, // type function + dummy // handle +) + +void uiRadioButtonsAppend(uiRadioButtons *r, const char *text) +{ + // TODO +} + +uiRadioButtons *uiNewRadioButtons(void) +{ + uiRadioButtons *r; + + r = (uiRadioButtons *) uiNewControl(uiRadioButtonsType()); + + r->dummy = mkdummy(L"uiRadioButtons"); + + uiWindowsFinishNewControl(r, uiRadioButtons, dummy); + + return r; +} diff --git a/wpf/separator.cpp b/wpf/separator.cpp new file mode 100644 index 00000000..07cb306e --- /dev/null +++ b/wpf/separator.cpp @@ -0,0 +1,26 @@ +// 18 november 2015 +#include "uipriv_wpf.hpp" + +struct uiSeparator { + uiWindowsControl c; + DUMMY dummy; +}; + +uiWindowsDefineControl( + uiSeparator, // type name + uiSeparatorType, // type function + dummy // handle +) + +uiSeparator *uiNewHorizontalSeparator(void) +{ + uiSeparator *s; + + s = (uiSeparator *) uiNewControl(uiSeparatorType()); + + s->dummy = mkdummy(L"uiSeparator"); + + uiWindowsFinishNewControl(s, uiSeparator, dummy); + + return s; +} diff --git a/wpf/slider.cpp b/wpf/slider.cpp new file mode 100644 index 00000000..217d8681 --- /dev/null +++ b/wpf/slider.cpp @@ -0,0 +1,52 @@ +// 18 november 2015 +#include "uipriv_wpf.hpp" + +struct uiSlider { + uiWindowsControl c; + DUMMY dummy; + void (*onChanged)(uiSlider *, void *); + void *onChangedData; +}; + +uiWindowsDefineControl( + uiSlider, // type name + uiSliderType, // type function + dummy // handle +) + +static void defaultOnChanged(uiSlider *s, void *data) +{ + // do nothing +} + +intmax_t uiSliderValue(uiSlider *s) +{ + // TODO + return -1; +} + +void uiSliderSetValue(uiSlider *s, intmax_t value) +{ + // TODO +} + +void uiSliderOnChanged(uiSlider *s, void (*f)(uiSlider *s, void *data), void *data) +{ + s->onChanged = f; + s->onChangedData = data; +} + +uiSlider *uiNewSlider(intmax_t min, intmax_t max) +{ + uiSlider *s; + + s = (uiSlider *) uiNewControl(uiSliderType()); + + s->dummy = mkdummy(L"uiSlider"); + + uiSliderOnChanged(s, defaultOnChanged, NULL); + + uiWindowsFinishNewControl(s, uiSlider, dummy); + + return s; +} diff --git a/wpf/spinbox.cpp b/wpf/spinbox.cpp new file mode 100644 index 00000000..ee128d69 --- /dev/null +++ b/wpf/spinbox.cpp @@ -0,0 +1,42 @@ +// 18 november 2015 +#include "uipriv_wpf.hpp" + +struct uiSpinbox { + uiWindowsControl c; + DUMMY dummy; +}; + +uiWindowsDefineControl( + uiSpinbox, // type name + uiSpinboxType, // type function + dummy // handle +) + +intmax_t uiSpinboxValue(uiSpinbox *s) +{ + // TODO + return 0; +} + +void uiSpinboxSetValue(uiSpinbox *s, intmax_t value) +{ + // TODO +} + +void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *s, void *data), void *data) +{ + // TODO +} + +uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max) +{ + uiSpinbox *s; + + s = (uiSpinbox *) uiNewControl(uiSpinboxType()); + + s->dummy = mkdummy(L"uiSpinbox"); + + uiWindowsFinishNewControl(s, uiSpinbox, dummy); + + return s; +} diff --git a/wpf/stddialogs.cpp b/wpf/stddialogs.cpp new file mode 100644 index 00000000..388176fd --- /dev/null +++ b/wpf/stddialogs.cpp @@ -0,0 +1,24 @@ +// 26 june 2015 +#include "uipriv_wpf.hpp" + +char *uiOpenFile(void) +{ + // TODO + return NULL; +} + +char *uiSaveFile(void) +{ + // TODO + return NULL; +} + +void uiMsgBox(const char *title, const char *description) +{ + // TODO +} + +void uiMsgBoxError(const char *title, const char *description) +{ + // TODO +} diff --git a/wpf/tab.cpp b/wpf/tab.cpp index 052cceb3..e1b52d0b 100644 --- a/wpf/tab.cpp +++ b/wpf/tab.cpp @@ -2,6 +2,7 @@ #include "uipriv_wpf.hpp" // TODO save child alignments? +// TODO scroll tabs instead of multiline tabs using namespace System::Collections::Generic; diff --git a/wpf/uipriv_wpf.hpp b/wpf/uipriv_wpf.hpp index f1424300..62021ab5 100644 --- a/wpf/uipriv_wpf.hpp +++ b/wpf/uipriv_wpf.hpp @@ -19,3 +19,14 @@ extern String ^fromUTF8(const char *); // control.cpp extern UIElement ^genericHandle(uiControl *c); + +typedef gcroot