2018-08-26 09:19:10 -05:00
|
|
|
// 26 august 2018
|
|
|
|
#include "pkgui.h"
|
2018-08-26 12:18:53 -05:00
|
|
|
#include "_cgo_export.h"
|
2018-08-26 09:19:10 -05:00
|
|
|
|
|
|
|
uiInitOptions *pkguiAllocInitOptions(void)
|
|
|
|
{
|
|
|
|
return (uiInitOptions *) pkguiAlloc(sizeof (uiInitOptions));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeInitOptions(uiInitOptions *o)
|
|
|
|
{
|
|
|
|
free(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiQueueMain(uintptr_t n)
|
|
|
|
{
|
|
|
|
uiQueueMain(pkguiDoQueueMain, (void *) n);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiOnShouldQuit(void)
|
|
|
|
{
|
|
|
|
uiOnShouldQuit(pkguiDoOnShouldQuit, NULL);
|
|
|
|
}
|
2018-08-26 12:24:47 -05:00
|
|
|
|
|
|
|
void pkguiWindowOnClosing(uiWindow *w)
|
|
|
|
{
|
|
|
|
uiWindowOnClosing(w, pkguiDoWindowOnClosing, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiButtonOnClicked(uiButton *b)
|
|
|
|
{
|
|
|
|
uiButtonOnClicked(b, pkguiDoButtonOnClicked, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiCheckboxOnToggled(uiCheckbox *c)
|
|
|
|
{
|
|
|
|
uiCheckboxOnToggled(c, pkguiDoCheckboxOnToggled, NULL);
|
|
|
|
}
|
2018-08-26 12:33:54 -05:00
|
|
|
|
2018-08-26 16:08:41 -05:00
|
|
|
void pkguiColorButtonOnChanged(uiColorButton *c)
|
|
|
|
{
|
|
|
|
uiColorButtonOnChanged(c, pkguiDoColorButtonOnChanged, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
pkguiColorDoubles pkguiAllocColorDoubles(void)
|
|
|
|
{
|
|
|
|
pkguiColorDoubles c;
|
|
|
|
|
|
|
|
c.r = (double *) pkguiAlloc(4 * sizeof (double));
|
|
|
|
c.g = c.r + 1;
|
|
|
|
c.b = c.g + 1;
|
|
|
|
c.a = c.b + 1;
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeColorDoubles(pkguiColorDoubles c)
|
|
|
|
{
|
|
|
|
free(c.r);
|
|
|
|
}
|
|
|
|
|
2018-08-26 12:33:54 -05:00
|
|
|
void pkguiComboboxOnSelected(uiCombobox *c)
|
|
|
|
{
|
|
|
|
uiComboboxOnSelected(c, pkguiDoComboboxOnSelected, NULL);
|
|
|
|
}
|
|
|
|
|
2018-08-26 12:48:13 -05:00
|
|
|
void pkguiDateTimePickerOnChanged(uiDateTimePicker *d)
|
|
|
|
{
|
|
|
|
uiDateTimePickerOnChanged(d, pkguiDoDateTimePickerOnChanged, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct tm *pkguiAllocTime(void)
|
|
|
|
{
|
|
|
|
return (struct tm *) pkguiAlloc(sizeof (struct tm));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeTime(struct tm *t)
|
|
|
|
{
|
|
|
|
free(t);
|
|
|
|
}
|
|
|
|
|
2018-08-26 12:33:54 -05:00
|
|
|
void pkguiEditableComboboxOnChanged(uiEditableCombobox *c)
|
|
|
|
{
|
|
|
|
uiEditableComboboxOnChanged(c, pkguiDoEditableComboboxOnChanged, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiEntryOnChanged(uiEntry *e)
|
|
|
|
{
|
|
|
|
uiEntryOnChanged(e, pkguiDoEntryOnChanged, NULL);
|
|
|
|
}
|
2018-08-26 12:43:05 -05:00
|
|
|
|
2018-08-26 16:17:03 -05:00
|
|
|
void pkguiFontButtonOnChanged(uiFontButton *b)
|
|
|
|
{
|
|
|
|
uiFontButtonOnChanged(b, pkguiDoFontButtonOnChanged, NULL);
|
|
|
|
}
|
|
|
|
|
2018-08-26 12:43:05 -05:00
|
|
|
void pkguiMultilineEntryOnChanged(uiMultilineEntry *e)
|
|
|
|
{
|
|
|
|
uiMultilineEntryOnChanged(e, pkguiDoMultilineEntryOnChanged, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiRadioButtonsOnSelected(uiRadioButtons *r)
|
|
|
|
{
|
|
|
|
uiRadioButtonsOnSelected(r, pkguiDoRadioButtonsOnSelected, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiSliderOnChanged(uiSlider *s)
|
|
|
|
{
|
|
|
|
uiSliderOnChanged(s, pkguiDoSliderOnChanged, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiSpinboxOnChanged(uiSpinbox *s)
|
|
|
|
{
|
|
|
|
uiSpinboxOnChanged(s, pkguiDoSpinboxOnChanged, NULL);
|
|
|
|
}
|
2018-08-26 13:09:49 -05:00
|
|
|
|
|
|
|
uiDrawBrush *pkguiAllocBrush(void)
|
|
|
|
{
|
|
|
|
return (uiDrawBrush *) pkguiAlloc(sizeof (uiDrawBrush));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeBrush(uiDrawBrush *b)
|
|
|
|
{
|
|
|
|
free(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
uiDrawBrushGradientStop *pkguiAllocGradientStops(size_t n)
|
|
|
|
{
|
|
|
|
return (uiDrawBrushGradientStop *) pkguiAlloc(n * sizeof (uiDrawBrushGradientStop));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeGradientStops(uiDrawBrushGradientStop *stops)
|
|
|
|
{
|
|
|
|
free(stops);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiSetGradientStop(uiDrawBrushGradientStop *stops, size_t i, double pos, double r, double g, double b, double a)
|
|
|
|
{
|
|
|
|
stops[i].Pos = pos;
|
|
|
|
stops[i].R = r;
|
|
|
|
stops[i].G = g;
|
|
|
|
stops[i].B = b;
|
|
|
|
stops[i].A = a;
|
|
|
|
}
|
|
|
|
|
|
|
|
uiDrawStrokeParams *pkguiAllocStrokeParams(void)
|
|
|
|
{
|
|
|
|
return (uiDrawStrokeParams *) pkguiAlloc(sizeof (uiDrawStrokeParams));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeStrokeParams(uiDrawStrokeParams *p)
|
|
|
|
{
|
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
double *pkguiAllocDashes(size_t n)
|
|
|
|
{
|
|
|
|
return (double *) pkguiAlloc(n * sizeof (double));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeDashes(double *dashes)
|
|
|
|
{
|
|
|
|
free(dashes);
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiSetDash(double *dashes, size_t i, double dash)
|
|
|
|
{
|
|
|
|
dashes[i] = dash;
|
|
|
|
}
|
|
|
|
|
|
|
|
uiDrawMatrix *pkguiAllocMatrix(void)
|
|
|
|
{
|
|
|
|
return (uiDrawMatrix *) pkguiAlloc(sizeof (uiDrawMatrix));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeMatrix(uiDrawMatrix *m)
|
|
|
|
{
|
|
|
|
free(m);
|
|
|
|
}
|
2018-08-26 16:17:03 -05:00
|
|
|
|
|
|
|
uiUnderlineColor *pkguiNewUnderlineColor(void)
|
|
|
|
{
|
|
|
|
return (uiUnderlineColor *) pkguiAlloc(sizeof (uiUnderlineColor));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeUnderlineColor(uiUnderlineColor *c)
|
|
|
|
{
|
|
|
|
free(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
uiFontDescriptor *pkguiNewFontDescriptor(void)
|
|
|
|
{
|
|
|
|
return (uiFontDescriptor *) pkguiAlloc(sizeof (uiFontDescriptor));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeFontDescriptor(uiFontDescriptor *fd)
|
|
|
|
{
|
|
|
|
free(fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
uiDrawTextLayoutParams *pkguiNewDrawTextLayoutParams(void)
|
|
|
|
{
|
|
|
|
return (uiDrawTextLayoutParams *) pkguiAlloc(sizeof (uiDrawTextLayoutParams));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeDrawTextLayoutParams(uiDrawTextLayoutParams *p)
|
|
|
|
{
|
|
|
|
free(p);
|
|
|
|
}
|
2018-08-26 16:22:05 -05:00
|
|
|
|
|
|
|
uiAreaHandler *pkguiAllocAreaHandler(void)
|
|
|
|
{
|
|
|
|
uiAreaHandler *ah;
|
|
|
|
|
|
|
|
ah = (uiAreaHandler *) pkguiAlloc(sizeof (uiAreaHandler));
|
|
|
|
ah->Draw = pkguiDoAreaHandlerDraw;
|
|
|
|
ah->MouseEvent = pkguiDoAreaHandlerMouseEvent;
|
|
|
|
ah->MouseCrossed = pkguiDoAreaHandlerMouseCrossed;
|
|
|
|
ah->DragBroken = pkguiDoAreaHandlerDragBroken;
|
|
|
|
ah->KeyEvent = pkguiDoAreaHandlerKeyEvent;
|
|
|
|
return ah;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeAreaHandler(uiAreaHandler *ah)
|
|
|
|
{
|
|
|
|
free(ah);
|
|
|
|
}
|
2018-08-26 16:36:39 -05:00
|
|
|
|
|
|
|
// cgo can't generate const, so we need this trampoline
|
|
|
|
static void realDoTableModelSetCellValue(uiTableModelHandler *mh, uiTableModel *m, int row, int column, const uiTableValue *value)
|
|
|
|
{
|
|
|
|
pkguiDoTableModelSetCellValue(mh, m, row, column, (uiTableValue *) value);
|
|
|
|
}
|
|
|
|
|
|
|
|
const uiTableModelHandler pkguiTableModelHandler = {
|
|
|
|
.NumColumns = pkguiDoTableModelNumColumns,
|
|
|
|
.ColumnType = pkguiDoTableModelColumnType,
|
|
|
|
.NumRows = pkguiDoTableModelNumRows,
|
|
|
|
.CellValue = pkguiDoTableModelCellValue,
|
|
|
|
.SetCellValue = realDoTableModelSetCellValue,
|
|
|
|
};
|
2018-08-26 18:55:10 -05:00
|
|
|
|
|
|
|
uiTableTextColumnOptionalParams *pkguiAllocTableTextColumnOptionalParams(void)
|
|
|
|
{
|
|
|
|
return (uiTableTextColumnOptionalParams *) pkguiAlloc(sizeof (uiTableTextColumnOptionalParams));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeTableTextColumnOptionalParams(uiTableTextColumnOptionalParams *p)
|
|
|
|
{
|
|
|
|
free(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
uiTableParams *pkguiAllocTableParams(void)
|
|
|
|
{
|
|
|
|
return (uiTableParams *) pkguiAlloc(sizeof (uiTableParams));
|
|
|
|
}
|
|
|
|
|
|
|
|
void pkguiFreeTableParams(uiTableParams *p)
|
|
|
|
{
|
|
|
|
free(p);
|
|
|
|
}
|