2015-04-22 12:42:52 -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 {
|
|
|
|
|
2015-05-07 19:33:09 -05:00
|
|
|
raw "#include <stddef.h>";
|
2015-04-22 12:42:52 -05:00
|
|
|
raw "#include <stdint.h>";
|
|
|
|
|
2015-04-22 13:09:17 -05:00
|
|
|
raw "#ifndef _UI_EXTERN";
|
|
|
|
raw "#define _UI_EXTERN extern";
|
|
|
|
raw "#endif";
|
|
|
|
|
2015-04-22 12:42:52 -05:00
|
|
|
struct InitOptions {
|
2015-05-07 19:26:56 -05:00
|
|
|
field Size size_t;
|
2015-04-22 12:42:52 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
func Init(options *InitOptions) *const char;
|
2015-05-07 21:28:18 -05:00
|
|
|
func Uninit(void);
|
2015-04-22 12:42:52 -05:00
|
|
|
func FreeInitError(err *const char);
|
|
|
|
|
|
|
|
func Main(void);
|
|
|
|
func Quit(void);
|
|
|
|
|
2015-05-09 08:50:23 -05:00
|
|
|
func OnShouldQuit(f *func(data *void) int, data *void);
|
|
|
|
|
2015-04-22 12:42:52 -05:00
|
|
|
func FreeText(text *char);
|
|
|
|
|
|
|
|
raw "typedef struct uiSizingSys uiSizingSys;";
|
|
|
|
|
|
|
|
struct Sizing {
|
2015-05-07 13:33:46 -05:00
|
|
|
field XPadding intmax_t;
|
|
|
|
field YPadding intmax_t;
|
|
|
|
field Sys *uiSizingSys;
|
2015-04-22 12:42:52 -05:00
|
|
|
};
|
|
|
|
|
2015-05-03 23:50:10 -05:00
|
|
|
raw "typedef struct uiControlSysFuncParams uiControlSysFuncParams;";
|
2015-05-03 23:38:10 -05:00
|
|
|
|
2015-04-22 12:42:52 -05:00
|
|
|
interface Control {
|
|
|
|
field Internal *void; // for use by ui only
|
|
|
|
func Destroy(void);
|
|
|
|
func Handle(void) uintptr_t;
|
2015-04-26 22:01:00 -05:00
|
|
|
func SetParent(c *Container);
|
2015-04-22 12:42:52 -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);
|
2015-04-27 09:39:21 -05:00
|
|
|
func Visible(void) int;
|
2015-04-22 12:42:52 -05:00
|
|
|
func Show(void);
|
|
|
|
func Hide(void);
|
|
|
|
func Enable(void);
|
|
|
|
func Disable(void);
|
2015-05-03 23:38:10 -05:00
|
|
|
func SysFunc(p *uiControlSysFuncParams);
|
2015-04-22 12:42:52 -05:00
|
|
|
};
|
|
|
|
|
2015-04-26 22:01:00 -05:00
|
|
|
interface Container from Control {
|
2015-04-26 23:57:44 -05:00
|
|
|
func ResizeChildren(x intmax_t, y intmax_t, width intmax_t, height intmax_t, d *Sizing);
|
2015-04-27 21:17:15 -05:00
|
|
|
func Update(void);
|
2015-04-25 17:28:49 -05:00
|
|
|
};
|
2015-04-26 22:01:00 -05:00
|
|
|
func MakeContainer(c *Container);
|
2015-04-22 12:42:52 -05:00
|
|
|
|
2015-05-10 11:36:14 -05:00
|
|
|
interface Bin from Container {
|
|
|
|
func SetMainControl(c *Control);
|
|
|
|
func SetMargins(left intmax_t, top intmax_t, right intmax_t, bottom intmax_t);
|
|
|
|
// defined by each OS
|
|
|
|
func HasOSParent(void) int;
|
|
|
|
func SetOSParent(parent uintptr_t);
|
|
|
|
func RemoveOSParent(void);
|
|
|
|
func ResizeRoot(x intmax_t, y intmax_t, width intmax_t, height intmax_t);
|
|
|
|
func TranslateMargins(left *intmax_t, top *intmax_t, right *intmax_t, bottom *intmax_t, d *Sizing);
|
|
|
|
};
|
|
|
|
|
2015-04-27 17:04:41 -05:00
|
|
|
interface Window from Control {
|
2015-04-22 12:42:52 -05:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
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-04-26 22:01:00 -05:00
|
|
|
interface Box from Container {
|
2015-04-22 12:42:52 -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);
|
2015-05-06 18:54:42 -05:00
|
|
|
func OnChanged(f *func(e *Entry, data *void), data *void);
|
2015-05-06 21:09:10 -05:00
|
|
|
func ReadOnly(void) int;
|
|
|
|
func SetReadOnly(readonly int);
|
2015-04-22 12:42:52 -05:00
|
|
|
};
|
|
|
|
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-04-28 20:47:18 -05:00
|
|
|
func AppendPage(name *const char, c *Control);
|
2015-05-06 12:58:03 -05:00
|
|
|
func InsertPageBefore(name *const char, before uintmax_t, c *Control);
|
2015-04-22 12:42:52 -05:00
|
|
|
func DeletePage(index uintmax_t);
|
2015-04-30 14:24:27 -05:00
|
|
|
func NumPages(void) uintmax_t;
|
|
|
|
func Margined(page uintmax_t) int;
|
|
|
|
func SetMargined(page uintmax_t, margined int);
|
2015-04-22 12:42:52 -05:00
|
|
|
};
|
|
|
|
func NewTab(void) *Tab;
|
|
|
|
|
|
|
|
interface Menu {
|
2015-04-23 12:11:36 -05:00
|
|
|
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);
|
2015-04-22 12:42:52 -05:00
|
|
|
};
|
2015-04-22 14:47:37 -05:00
|
|
|
func NewMenu(name *const char) *Menu;
|
2015-04-22 12:42:52 -05:00
|
|
|
|
|
|
|
interface MenuItem {
|
|
|
|
func Enable(void);
|
|
|
|
func Disable(void);
|
2015-04-23 11:15:27 -05:00
|
|
|
func OnClicked(f *func(sender *MenuItem, window *Window, data *void), data *void);
|
2015-04-22 12:42:52 -05:00
|
|
|
func Checked(void) int;
|
|
|
|
func SetChecked(checked int);
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|