2015-05-13 21:28:21 -05:00
|
|
|
// 6 april 2015
|
|
|
|
|
|
|
|
// This is not an IDL file for the conventional RPC or Microsoft IDLs.
|
|
|
|
// Instead, this is for a custom IDL of my own creation.
|
|
|
|
// You can find it at github.com/andlabs/pgidl
|
|
|
|
|
|
|
|
package ui {
|
|
|
|
|
|
|
|
raw "#include <stddef.h>";
|
|
|
|
raw "#include <stdint.h>";
|
|
|
|
|
|
|
|
raw "#ifndef _UI_EXTERN";
|
|
|
|
raw "#define _UI_EXTERN extern";
|
|
|
|
raw "#endif";
|
|
|
|
|
|
|
|
struct InitOptions {
|
|
|
|
field Size size_t;
|
|
|
|
};
|
|
|
|
|
|
|
|
func Init(options *InitOptions) *const char;
|
|
|
|
func Uninit(void);
|
|
|
|
func FreeInitError(err *const char);
|
|
|
|
|
|
|
|
func Main(void);
|
|
|
|
func Quit(void);
|
|
|
|
|
|
|
|
func OnShouldQuit(f *func(data *void) int, data *void);
|
|
|
|
|
|
|
|
func FreeText(text *char);
|
|
|
|
|
2015-05-29 13:56:11 -05:00
|
|
|
func RegisterType(name *const char, parent uintmax_t, size size_t) uintmax_t;
|
2015-05-17 17:53:06 -05:00
|
|
|
func IsA(p *void, type uintmax_t, fail int) *void;
|
2015-05-17 17:33:18 -05:00
|
|
|
struct Typed {
|
2015-05-17 17:07:48 -05:00
|
|
|
field Type uintmax_t;
|
|
|
|
};
|
2015-05-17 18:07:07 -05:00
|
|
|
raw "#define uiTyped(this) ((uiTyped *) (this))";
|
2015-05-17 17:07:48 -05:00
|
|
|
|
2015-05-13 21:28:21 -05:00
|
|
|
raw "typedef struct uiSizingSys uiSizingSys;";
|
|
|
|
|
|
|
|
struct Sizing {
|
|
|
|
field XPadding intmax_t;
|
|
|
|
field YPadding intmax_t;
|
|
|
|
field Sys *uiSizingSys;
|
|
|
|
};
|
|
|
|
|
|
|
|
raw "typedef struct uiControlSysFuncParams uiControlSysFuncParams;";
|
|
|
|
raw "#define uiControlSysFuncNop 0";
|
|
|
|
|
|
|
|
interface Control {
|
|
|
|
field Internal *void; // for use by ui only
|
|
|
|
func Destroy(void);
|
|
|
|
func Handle(void) uintptr_t;
|
2015-05-14 09:08:49 -05:00
|
|
|
func Parent(void) *Control;
|
|
|
|
func SetParent(c *Control);
|
2015-05-13 21:28:21 -05:00
|
|
|
func PreferredSize(d *Sizing, width *intmax_t, height *intmax_t);
|
|
|
|
func Resize(x intmax_t, y intmax_t, width intmax_t, height intmax_t, d *Sizing);
|
|
|
|
func QueueResize(void);
|
2015-05-18 10:46:50 -05:00
|
|
|
func Sizing(void) *Sizing;
|
2015-05-15 17:34:17 -05:00
|
|
|
func ContainerVisible(void) int;
|
2015-05-13 21:28:21 -05:00
|
|
|
func Show(void);
|
|
|
|
func Hide(void);
|
2015-05-29 13:56:11 -05:00
|
|
|
func ContainerEnabled(void) int;
|
2015-05-13 21:28:21 -05:00
|
|
|
func Enable(void);
|
|
|
|
func Disable(void);
|
2015-05-29 13:56:11 -05:00
|
|
|
func UpdateState(void);
|
2015-05-13 21:28:21 -05:00
|
|
|
func SysFunc(p *uiControlSysFuncParams);
|
2015-05-14 18:28:30 -05:00
|
|
|
func StartZOrder(p *uiControlSysFuncParams) int;
|
2015-05-29 13:56:11 -05:00
|
|
|
func CommitDestroy(void);
|
2015-05-29 19:01:11 -05:00
|
|
|
func CommitSetParent(parent *uiControl);
|
2015-05-29 13:56:11 -05:00
|
|
|
func CommitShow(void);
|
|
|
|
func CommitHide(void);
|
|
|
|
func CommitEnable(void);
|
|
|
|
func CommitDisable(void);
|
|
|
|
func ContainerUpdateState(void);
|
2015-05-13 21:28:21 -05:00
|
|
|
};
|
|
|
|
|
2015-05-29 13:56:11 -05:00
|
|
|
func NewControl(type uintmax_t) *Control;
|
|
|
|
|
2015-05-29 19:01:11 -05:00
|
|
|
raw "#define uiDefineControlType(typename, funcname, realtype) \\";
|
|
|
|
raw " static uintmax_t type_ ## typename = 0; \\";
|
|
|
|
raw " uintmax_t funcname(void) \\";
|
|
|
|
raw " { \\";
|
|
|
|
raw " if (type_ ## typename == 0) \\";
|
|
|
|
raw " type_ ## typename = uiRegisterType(#typename, uiTypeControl(), sizeof (realtype)); \\";
|
|
|
|
raw " return type_ ## typename; \\";
|
2015-05-29 13:56:11 -05:00
|
|
|
raw " }";
|
|
|
|
|
2015-05-18 10:46:50 -05:00
|
|
|
func FreeSizing(d *Sizing);
|
|
|
|
|
2015-05-29 19:40:54 -05:00
|
|
|
func MakeContainer(c *Control) uintptr_t;
|
2015-05-13 21:28:21 -05:00
|
|
|
|
|
|
|
interface Window from Control {
|
|
|
|
func Title(void) *char;
|
|
|
|
func SetTitle(title *const char);
|
|
|
|
func OnClosing(f *func(w *Window, data *void) int, data *void);
|
|
|
|
func SetChild(c *Control);
|
|
|
|
func Margined(void) int;
|
|
|
|
func SetMargined(margined int);
|
2015-05-17 20:15:39 -05:00
|
|
|
func ResizeChild(void);
|
2015-05-13 21:28:21 -05:00
|
|
|
};
|
|
|
|
func NewWindow(title *const char, width int, height int, hasMenubar int) *Window;
|
|
|
|
|
|
|
|
interface Button from Control {
|
|
|
|
func Text(void) *char;
|
|
|
|
func SetText(text *const char);
|
|
|
|
func OnClicked(f *func(b *Button, data *void), data *void);
|
|
|
|
};
|
|
|
|
func NewButton(text *const char) *Button;
|
|
|
|
|
2015-05-16 00:45:20 -05:00
|
|
|
interface Box from Control {
|
2015-05-13 21:28:21 -05:00
|
|
|
func Append(c *Control, stretchy int);
|
|
|
|
func Delete(index uintmax_t);
|
|
|
|
func Padded(void) int;
|
|
|
|
func SetPadded(padded int);
|
|
|
|
};
|
|
|
|
func NewHorizontalBox(void) *Box;
|
|
|
|
func NewVerticalBox(void) *Box;
|
|
|
|
|
|
|
|
interface Entry from Control {
|
|
|
|
func Text(void) *char;
|
|
|
|
func SetText(text *const char);
|
|
|
|
func OnChanged(f *func(e *Entry, data *void), data *void);
|
|
|
|
func ReadOnly(void) int;
|
|
|
|
func SetReadOnly(readonly int);
|
|
|
|
};
|
|
|
|
func NewEntry(void) *Entry;
|
|
|
|
|
|
|
|
interface Checkbox from Control {
|
|
|
|
func Text(void) *char;
|
|
|
|
func SetText(text *const char);
|
|
|
|
func OnToggled(f *func(c *Checkbox, data *void), data *void);
|
|
|
|
func Checked(void) int;
|
|
|
|
func SetChecked(checked int);
|
|
|
|
};
|
|
|
|
func NewCheckbox(text *const char) *Checkbox;
|
|
|
|
|
|
|
|
interface Label from Control {
|
|
|
|
func Text(void) *char;
|
|
|
|
func SetText(text *const char);
|
|
|
|
};
|
|
|
|
func NewLabel(text *const char) *Label;
|
|
|
|
|
|
|
|
interface Tab from Control {
|
2015-05-18 09:20:11 -05:00
|
|
|
func Append(name *const char, c *Control);
|
2015-05-18 09:32:08 -05:00
|
|
|
func InsertAt(name *const char, before uintmax_t, c *Control);
|
2015-05-18 09:20:11 -05:00
|
|
|
func Delete(index uintmax_t);
|
2015-05-13 21:28:21 -05:00
|
|
|
func NumPages(void) uintmax_t;
|
|
|
|
func Margined(page uintmax_t) int;
|
|
|
|
func SetMargined(page uintmax_t, margined int);
|
|
|
|
};
|
|
|
|
func NewTab(void) *Tab;
|
|
|
|
|
|
|
|
interface Group from Control {
|
|
|
|
// TODO text and settext
|
|
|
|
func SetChild(c *Control);
|
|
|
|
// TODO margined and setmargined
|
|
|
|
};
|
|
|
|
func NewGroup(text *const char) *Group;
|
|
|
|
|
2015-05-20 11:24:06 -05:00
|
|
|
// spinbox/slider rules:
|
|
|
|
// setting value outside of range will automatically clamp
|
2015-05-20 12:25:45 -05:00
|
|
|
// initial value is minimum
|
|
|
|
// TODO what happens if max > min? max == min?
|
2015-05-20 11:24:06 -05:00
|
|
|
|
2015-05-19 11:15:50 -05:00
|
|
|
interface Spinbox from Control {
|
2015-05-19 17:17:30 -05:00
|
|
|
func Value(void) intmax_t;
|
2015-05-20 11:24:06 -05:00
|
|
|
func SetValue(value intmax_t);
|
2015-05-19 17:17:30 -05:00
|
|
|
func OnChanged(f *func(s *Spinbox, data *void), data *void);
|
2015-05-19 11:15:50 -05:00
|
|
|
};
|
2015-05-20 12:25:45 -05:00
|
|
|
func NewSpinbox(min intmax_t, max intmax_t) *Spinbox;
|
2015-05-19 11:15:50 -05:00
|
|
|
|
2015-05-19 20:05:18 -05:00
|
|
|
interface ProgressBar from Control {
|
|
|
|
// TODO Value()
|
|
|
|
func SetValue(n int);
|
|
|
|
};
|
|
|
|
func NewProgressBar(void) *ProgressBar;
|
|
|
|
|
2015-05-20 09:29:57 -05:00
|
|
|
interface Slider from Control {
|
|
|
|
func Value(void) intmax_t;
|
2015-05-20 11:24:06 -05:00
|
|
|
func SetValue(value intmax_t);
|
2015-05-20 09:29:57 -05:00
|
|
|
func OnChanged(f *func(s *Slider, data *void), data *void);
|
|
|
|
};
|
2015-05-20 12:25:45 -05:00
|
|
|
func NewSlider(min intmax_t, max intmax_t) *Slider;
|
2015-05-20 09:29:57 -05:00
|
|
|
|
2015-05-20 13:08:34 -05:00
|
|
|
interface Separator from Control {
|
|
|
|
};
|
|
|
|
func NewHorizontalSeparator(void) *Separator;
|
|
|
|
|
2015-05-20 16:09:58 -05:00
|
|
|
interface Combobox from Control {
|
|
|
|
func Append(text *const char);
|
|
|
|
};
|
|
|
|
func NewCombobox(void) *Combobox;
|
2015-05-21 20:45:31 -05:00
|
|
|
func NewEditableCombobox(void) *Combobox;
|
2015-05-20 16:09:58 -05:00
|
|
|
|
2015-05-20 16:52:21 -05:00
|
|
|
interface RadioButtons from Control {
|
|
|
|
func Append(text *const char);
|
|
|
|
};
|
|
|
|
func NewRadioButtons(void) *RadioButtons;
|
|
|
|
|
2015-05-22 09:36:24 -05:00
|
|
|
interface DateTimePicker from Control {
|
|
|
|
};
|
|
|
|
func NewDateTimePicker(void) *DateTimePicker;
|
|
|
|
func NewDatePicker(void) *DateTimePicker;
|
|
|
|
func NewTimePicker(void) *DateTimePicker;
|
|
|
|
|
2015-05-13 21:28:21 -05:00
|
|
|
interface Menu {
|
|
|
|
func AppendItem(name *const char) *MenuItem;
|
|
|
|
func AppendCheckItem(name *const char) *MenuItem;
|
|
|
|
func AppendQuitItem(void) *MenuItem;
|
|
|
|
func AppendPreferencesItem(void) *MenuItem;
|
|
|
|
func AppendAboutItem(void) *MenuItem;
|
|
|
|
func AppendSeparator(void);
|
|
|
|
};
|
|
|
|
func NewMenu(name *const char) *Menu;
|
|
|
|
|
|
|
|
interface MenuItem {
|
|
|
|
func Enable(void);
|
|
|
|
func Disable(void);
|
|
|
|
func OnClicked(f *func(sender *MenuItem, window *Window, data *void), data *void);
|
|
|
|
func Checked(void) int;
|
|
|
|
func SetChecked(checked int);
|
|
|
|
};
|
|
|
|
|
2015-05-22 18:14:25 -05:00
|
|
|
func OpenFile(void) *char;
|
2015-05-22 20:59:32 -05:00
|
|
|
func SaveFile(void) *char;
|
2015-05-23 14:07:16 -05:00
|
|
|
func MsgBox(title *const char, description *const char);
|
|
|
|
func MsgBoxError(title *const char, description *const char);
|
2015-05-22 18:14:25 -05:00
|
|
|
|
2015-05-13 21:28:21 -05:00
|
|
|
};
|