Stubbed everything else. It works!

This commit is contained in:
Pietro Gagliardi 2015-11-26 18:27:23 -05:00
parent 2eca184d0a
commit 42b0bada64
16 changed files with 707 additions and 0 deletions

39
wpf/area.cpp Normal file
View File

@ -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;
}

60
wpf/combobox.cpp Normal file
View File

@ -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);
}

41
wpf/datetimepicker.cpp Normal file
View File

@ -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();
}

151
wpf/draw.cpp Normal file
View File

@ -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
}

63
wpf/entry.cpp Normal file
View File

@ -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;
}

53
wpf/group.cpp Normal file
View File

@ -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;
}

View File

@ -75,18 +75,31 @@
<ClCompile Include="alloc.c">
<CompileAsManaged>false</CompileAsManaged>
</ClCompile>
<ClCompile Include="area.cpp" />
<ClCompile Include="box.cpp" />
<ClCompile Include="button.cpp" />
<ClCompile Include="checkbox.cpp" />
<ClCompile Include="combobox.cpp" />
<ClCompile Include="control.cpp" />
<ClCompile Include="datetimepicker.cpp" />
<ClCompile Include="debug.c">
<CompileAsManaged>false</CompileAsManaged>
</ClCompile>
<ClCompile Include="draw.cpp" />
<ClCompile Include="entry.cpp" />
<ClCompile Include="group.cpp" />
<ClCompile Include="init.c">
<CompileAsManaged>false</CompileAsManaged>
</ClCompile>
<ClCompile Include="label.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="menu.cpp" />
<ClCompile Include="progressbar.cpp" />
<ClCompile Include="radiobuttons.cpp" />
<ClCompile Include="separator.cpp" />
<ClCompile Include="slider.cpp" />
<ClCompile Include="spinbox.cpp" />
<ClCompile Include="stddialogs.cpp" />
<ClCompile Include="tab.cpp" />
<ClCompile Include="text.cpp" />
<ClCompile Include="util.c">

69
wpf/menu.cpp Normal file
View File

@ -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;
}

31
wpf/progressbar.cpp Normal file
View File

@ -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;
}

31
wpf/radiobuttons.cpp Normal file
View File

@ -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;
}

26
wpf/separator.cpp Normal file
View File

@ -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;
}

52
wpf/slider.cpp Normal file
View File

@ -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;
}

42
wpf/spinbox.cpp Normal file
View File

@ -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;
}

24
wpf/stddialogs.cpp Normal file
View File

@ -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
}

View File

@ -2,6 +2,7 @@
#include "uipriv_wpf.hpp"
// TODO save child alignments?
// TODO scroll tabs instead of multiline tabs
using namespace System::Collections::Generic;

View File

@ -19,3 +19,14 @@ extern String ^fromUTF8(const char *);
// control.cpp
extern UIElement ^genericHandle(uiControl *c);
typedef gcroot<Label ^> *DUMMY;
static inline DUMMY mkdummy(String ^classname)
{
DUMMY t;
t = new gcroot<Label ^>();
*t = gcnew Label();
(*t)->Content = L"TODO " + classname + L" not implemented";
return t;
}