libui/ui.idl

132 lines
3.3 KiB
Plaintext

// 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 <stdint.h>";
raw "#ifndef _UI_EXTERN";
raw "#define _UI_EXTERN extern";
raw "#endif";
struct InitOptions {
};
func Init(options *InitOptions) *const char;
func FreeInitError(err *const char);
func Main(void);
func Quit(void);
func FreeText(text *char);
raw "typedef struct uiSizingSys uiSizingSys;";
struct Sizing {
field xPadding intmax_t;
field yPadding intmax_t;
field sys *uiSizingSys;
};
raw "typedef struct uiControlSysFuncParams uiControlSysFuncParams;";
interface Control {
field Internal *void; // for use by ui only
func Destroy(void);
func Handle(void) uintptr_t;
func SetParent(c *Container);
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 Visible(void) int;
func Show(void);
func Hide(void);
func Enable(void);
func Disable(void);
func SysFunc(p *uiControlSysFuncParams);
};
interface Container from Control {
func ResizeChildren(x intmax_t, y intmax_t, width intmax_t, height intmax_t, d *Sizing);
func Update(void);
};
func MakeContainer(c *Container);
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);
};
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;
interface Box from Container {
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 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 {
func AppendPage(name *const char, c *Control);
func DeletePage(index uintmax_t);
func NumPages(void) uintmax_t;
func Margined(page uintmax_t) int;
func SetMargined(page uintmax_t, margined int);
};
func NewTab(void) *Tab;
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);
};
};