Begin the GTK+ backend migration.
This commit is contained in:
parent
d8eeab30eb
commit
46b865a298
|
@ -0,0 +1,59 @@
|
|||
// 7 april 2015
|
||||
|
||||
/*
|
||||
This file assumes that you have included <gtk/gtk.h> and "ui.h" beforehand. It provides API-specific functions for interfacing with foreign controls on Unix systems that use GTK+ to provide their UI (currently all except Mac OS X).
|
||||
*/
|
||||
|
||||
#ifndef __LIBUI_UI_UNIX_H__
|
||||
#define __LIBUI_UI_UNIX_H__
|
||||
|
||||
typedef struct uiUnixControl uiUnixControl;
|
||||
struct uiUnixControl {
|
||||
uiControl c;
|
||||
};
|
||||
_UI_EXTERN uintmax_t uiUnixControlType(void);
|
||||
#define uiUnixControl(this) ((uiUnixControl *) uiIsA((this), uiUnixControlType(), 1))
|
||||
// TODO document
|
||||
_UI_EXTERN void uiUnixControlTriggerRelayout(uiUnixControl *);
|
||||
|
||||
// TODO document
|
||||
#define uiUnixDefineControlWithOnDestroy(type, typefn, onDestroy) \
|
||||
static uintmax_t _ ## type ## Type = 0; \
|
||||
uintmax_t typefn(void) \
|
||||
{ \
|
||||
if (_ ## type ## Type == 0) \
|
||||
_ ## type ## Type = uiRegisterType(#type, uiUnixControlType(), sizeof (type)); \
|
||||
return _ ## type ## Type; \
|
||||
} \
|
||||
static void _ ## type ## CommitDestroy(uiControl *c) \
|
||||
{ \
|
||||
type *this = type(c); \
|
||||
onDestroy; \
|
||||
g_object_unref(this->widget); \
|
||||
} \
|
||||
static uintptr_t _ ## type ## Handle(uiControl *c) \
|
||||
{ \
|
||||
return (uintptr_t) (type(c)->widget); \
|
||||
} \
|
||||
static void _ ## type ## ContainerUpdateState(uiControl *c) \
|
||||
{ \
|
||||
/* do nothing */ \
|
||||
}
|
||||
|
||||
#define uiUnixDefineControl(type, typefn) \
|
||||
uiUnixDefineControlWithOnDestroy(type, typefn, (void) this;)
|
||||
|
||||
#define uiUnixFinishNewControl(variable, type) \
|
||||
uiControl(variable)->CommitDestroy = _ ## type ## CommitDestroy; \
|
||||
uiControl(variable)->Handle = _ ## type ## Handle; \
|
||||
uiControl(variable)->ContainerUpdateState = _ ## type ## ContainerUpdateState; \
|
||||
uiUnixFinishControl(uiControl(variable));
|
||||
|
||||
// This is a function used to set up a control.
|
||||
// Don't call it directly; use uiUnixFinishNewControl() instead.
|
||||
_UI_EXTERN void uiUnixFinishControl(uiControl *c);
|
||||
|
||||
// uiUnixStrdupText() takes the given string and produces a copy of it suitable for being freed by uiFreeText().
|
||||
extern char *uiUnixStrdupText(const char *);
|
||||
|
||||
#endif
|
23
ui_unix.h
23
ui_unix.h
|
@ -1,23 +0,0 @@
|
|||
// 7 april 2015
|
||||
|
||||
/*
|
||||
This file assumes that you have included <gtk/gtk.h> and "ui.h" beforehand. It provides API-specific functions for interfacing with foreign controls on Unix systems that use GTK+ to provide their UI (currently all except Mac OS X).
|
||||
*/
|
||||
|
||||
#ifndef __UI_UI_UNIX_H__
|
||||
#define __UI_UI_UNIX_H__
|
||||
|
||||
// TODO write this comment
|
||||
_UI_EXTERN void uiUnixMakeSingleWidgetControl(uiControl *c, GtkWidget *widget);
|
||||
|
||||
// uiUnixStrdupText() takes the given string and produces a copy of it suitable for being freed by uiFreeText().
|
||||
extern char *uiUnixStrdupText(const char *);
|
||||
|
||||
struct uiSizingSys {
|
||||
// this structure currently left blank
|
||||
};
|
||||
|
||||
// This creates a uiSizing for Unix systems.
|
||||
_UI_EXTERN uiSizing *uiUnixNewSizing(void);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue