Did the rest of the object changes on GTK+.
This commit is contained in:
parent
fa4632d101
commit
96e8f1f8ea
|
@ -37,6 +37,10 @@ struct uiUnixControl {
|
||||||
#define uiUnixDefineControl(type) \
|
#define uiUnixDefineControl(type) \
|
||||||
uiUnixDefineControlWithOnDestroy(type, (void) this;)
|
uiUnixDefineControlWithOnDestroy(type, (void) this;)
|
||||||
|
|
||||||
|
// TODO document
|
||||||
|
#define uiNewControl(type) uiUnixNewControl(sizeof (type), type ## Signature, #type)
|
||||||
|
_UI_EXTERN uiUnixControl *uiUnixNewControl(size_t n, uint32_t typesig, const char *typename);
|
||||||
|
|
||||||
#define uiUnixFinishNewControl(variable, type) \
|
#define uiUnixFinishNewControl(variable, type) \
|
||||||
uiControl(variable)->CommitDestroy = _ ## type ## CommitDestroy; \
|
uiControl(variable)->CommitDestroy = _ ## type ## CommitDestroy; \
|
||||||
uiControl(variable)->Handle = _ ## type ## Handle; \
|
uiControl(variable)->Handle = _ ## type ## Handle; \
|
||||||
|
|
|
@ -510,7 +510,7 @@ uiArea *uiNewArea(uiAreaHandler *ah)
|
||||||
{
|
{
|
||||||
uiArea *a;
|
uiArea *a;
|
||||||
|
|
||||||
a = (uiArea *) uiNewControl(uiAreaType());
|
a = (uiArea *) uiNewControl(uiArea);
|
||||||
|
|
||||||
a->ah = ah;
|
a->ah = ah;
|
||||||
a->scrolling = FALSE;
|
a->scrolling = FALSE;
|
||||||
|
@ -532,7 +532,7 @@ uiArea *uiNewScrollingArea(uiAreaHandler *ah, intmax_t width, intmax_t height)
|
||||||
{
|
{
|
||||||
uiArea *a;
|
uiArea *a;
|
||||||
|
|
||||||
a = (uiArea *) uiNewControl(uiAreaType());
|
a = (uiArea *) uiNewControl(uiArea);
|
||||||
|
|
||||||
a->ah = ah;
|
a->ah = ah;
|
||||||
a->scrolling = TRUE;
|
a->scrolling = TRUE;
|
||||||
|
|
|
@ -110,7 +110,7 @@ static uiBox *finishNewBox(GtkOrientation orientation)
|
||||||
{
|
{
|
||||||
uiBox *b;
|
uiBox *b;
|
||||||
|
|
||||||
b = (uiBox *) uiNewControl(uiBoxType());
|
b = (uiBox *) uiNewControl(uiBox);
|
||||||
|
|
||||||
b->widget = gtk_box_new(orientation, 0);
|
b->widget = gtk_box_new(orientation, 0);
|
||||||
b->container = GTK_CONTAINER(b->widget);
|
b->container = GTK_CONTAINER(b->widget);
|
||||||
|
|
|
@ -47,7 +47,7 @@ uiButton *uiNewButton(const char *text)
|
||||||
{
|
{
|
||||||
uiButton *b;
|
uiButton *b;
|
||||||
|
|
||||||
b = (uiButton *) uiNewControl(uiButtonType());
|
b = (uiButton *) uiNewControl(uiButton);
|
||||||
|
|
||||||
b->widget = gtk_button_new_with_label(text);
|
b->widget = gtk_button_new_with_label(text);
|
||||||
b->button = GTK_BUTTON(b->widget);
|
b->button = GTK_BUTTON(b->widget);
|
||||||
|
|
|
@ -68,7 +68,7 @@ uiCheckbox *uiNewCheckbox(const char *text)
|
||||||
{
|
{
|
||||||
uiCheckbox *c;
|
uiCheckbox *c;
|
||||||
|
|
||||||
c = (uiCheckbox *) uiNewControl(uiCheckboxType());
|
c = (uiCheckbox *) uiNewControl(uiCheckbox);
|
||||||
|
|
||||||
c->widget = gtk_check_button_new_with_label(text);
|
c->widget = gtk_check_button_new_with_label(text);
|
||||||
c->button = GTK_BUTTON(c->widget);
|
c->button = GTK_BUTTON(c->widget);
|
||||||
|
|
|
@ -56,7 +56,7 @@ static uiCombobox *finishNewCombobox(GtkWidget *(*newfunc)(void))
|
||||||
{
|
{
|
||||||
uiCombobox *c;
|
uiCombobox *c;
|
||||||
|
|
||||||
c = (uiCombobox *) uiNewControl(uiComboboxType());
|
c = (uiCombobox *) uiNewControl(uiCombobox);
|
||||||
|
|
||||||
c->widget = (*newfunc)();
|
c->widget = (*newfunc)();
|
||||||
c->combobox = GTK_COMBO_BOX(c->widget);
|
c->combobox = GTK_COMBO_BOX(c->widget);
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
// 16 august 2015
|
// 16 august 2015
|
||||||
#include "uipriv_unix.h"
|
#include "uipriv_unix.h"
|
||||||
|
|
||||||
static uintmax_t type_uiUnixControl = 0;
|
|
||||||
|
|
||||||
uintmax_t uiUnixControlType(void)
|
|
||||||
{
|
|
||||||
if (type_uiUnixControl == 0)
|
|
||||||
type_uiUnixControl = uiRegisterType("uiUnixControl", uiControlType(), sizeof (uiUnixControl));
|
|
||||||
return type_uiUnixControl;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void defaultCommitShow(uiControl *c)
|
static void defaultCommitShow(uiControl *c)
|
||||||
{
|
{
|
||||||
gtk_widget_show(GTK_WIDGET(uiControlHandle(c)));
|
gtk_widget_show(GTK_WIDGET(uiControlHandle(c)));
|
||||||
|
@ -38,3 +29,10 @@ void uiUnixFinishControl(uiControl *c)
|
||||||
c->CommitShow = defaultCommitShow;
|
c->CommitShow = defaultCommitShow;
|
||||||
c->CommitHide = defaultCommitHide;
|
c->CommitHide = defaultCommitHide;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define uiUnixControlSignature 0x556E6978
|
||||||
|
|
||||||
|
uiUnixControl *uiUnixNewControl(size_t n, uint32_t typesig, const char *typename)
|
||||||
|
{
|
||||||
|
return uiUnixControl(newControl(n, uiUnixControlSignature, typesig, typename));
|
||||||
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ uiDateTimePicker *finishNewDateTimePicker(OSTHING OSARG)
|
||||||
{
|
{
|
||||||
uiDateTimePicker *d;
|
uiDateTimePicker *d;
|
||||||
|
|
||||||
d = (uiDateTimePicker *) uiNewControl(uiDateTimePickerType());
|
d = (uiDateTimePicker *) uiNewControl(uiDateTimePicker);
|
||||||
|
|
||||||
d->widget = gtk_label_new("TODO uiDateTimePicker not implemented");
|
d->widget = gtk_label_new("TODO uiDateTimePicker not implemented");
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ uiEntry *uiNewEntry(void)
|
||||||
{
|
{
|
||||||
uiEntry *e;
|
uiEntry *e;
|
||||||
|
|
||||||
e = (uiEntry *) uiNewControl(uiEntryType());
|
e = (uiEntry *) uiNewControl(uiEntry);
|
||||||
|
|
||||||
e->widget = gtk_entry_new();
|
e->widget = gtk_entry_new();
|
||||||
e->entry = GTK_ENTRY(e->widget);
|
e->entry = GTK_ENTRY(e->widget);
|
||||||
|
|
|
@ -50,7 +50,7 @@ uiFontButton *uiNewFontButton(void)
|
||||||
{
|
{
|
||||||
uiFontButton *b;
|
uiFontButton *b;
|
||||||
|
|
||||||
b = (uiFontButton *) uiNewControl(uiFontButtonType());
|
b = (uiFontButton *) uiNewControl(uiFontButton);
|
||||||
|
|
||||||
b->widget = gtk_font_button_new();
|
b->widget = gtk_font_button_new();
|
||||||
b->button = GTK_BUTTON(b->widget);
|
b->button = GTK_BUTTON(b->widget);
|
||||||
|
|
|
@ -78,7 +78,7 @@ uiGroup *uiNewGroup(const char *text)
|
||||||
PangoAttribute *bold;
|
PangoAttribute *bold;
|
||||||
PangoAttrList *boldlist;
|
PangoAttrList *boldlist;
|
||||||
|
|
||||||
g = (uiGroup *) uiNewControl(uiGroupType());
|
g = (uiGroup *) uiNewControl(uiGroup);
|
||||||
|
|
||||||
g->widget = gtk_frame_new(text);
|
g->widget = gtk_frame_new(text);
|
||||||
g->container = GTK_CONTAINER(g->widget);
|
g->container = GTK_CONTAINER(g->widget);
|
||||||
|
|
|
@ -28,7 +28,7 @@ uiLabel *uiNewLabel(const char *text)
|
||||||
{
|
{
|
||||||
uiLabel *l;
|
uiLabel *l;
|
||||||
|
|
||||||
l = (uiLabel *) uiNewControl(uiLabelType());
|
l = (uiLabel *) uiNewControl(uiLabel);
|
||||||
|
|
||||||
l->widget = gtk_label_new(text);
|
l->widget = gtk_label_new(text);
|
||||||
l->misc = GTK_MISC(l->widget);
|
l->misc = GTK_MISC(l->widget);
|
||||||
|
|
|
@ -8,13 +8,11 @@ static gboolean hasPreferences = FALSE;
|
||||||
static gboolean hasAbout = FALSE;
|
static gboolean hasAbout = FALSE;
|
||||||
|
|
||||||
struct uiMenu {
|
struct uiMenu {
|
||||||
uiTyped t;
|
|
||||||
char *name;
|
char *name;
|
||||||
GArray *items; // []*uiMenuItem
|
GArray *items; // []*uiMenuItem
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uiMenuItem {
|
struct uiMenuItem {
|
||||||
uiTyped t;
|
|
||||||
char *name;
|
char *name;
|
||||||
int type;
|
int type;
|
||||||
void (*onClicked)(uiMenuItem *, uiWindow *, void *);
|
void (*onClicked)(uiMenuItem *, uiWindow *, void *);
|
||||||
|
@ -140,7 +138,6 @@ static uiMenuItem *newItem(uiMenu *m, int type, const char *name)
|
||||||
complain("attempt to create a new menu item after menus have been finalized");
|
complain("attempt to create a new menu item after menus have been finalized");
|
||||||
|
|
||||||
item = uiNew(uiMenuItem);
|
item = uiNew(uiMenuItem);
|
||||||
uiTyped(item)->Type = uiMenuItemType();
|
|
||||||
|
|
||||||
g_array_append_val(m->items, item);
|
g_array_append_val(m->items, item);
|
||||||
|
|
||||||
|
@ -238,7 +235,6 @@ uiMenu *uiNewMenu(const char *name)
|
||||||
menus = g_array_new(FALSE, TRUE, sizeof (uiMenu *));
|
menus = g_array_new(FALSE, TRUE, sizeof (uiMenu *));
|
||||||
|
|
||||||
m = uiNew(uiMenu);
|
m = uiNew(uiMenu);
|
||||||
uiTyped(m)->Type = uiMenuType();
|
|
||||||
|
|
||||||
g_array_append_val(menus, m);
|
g_array_append_val(menus, m);
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ uiMultilineEntry *uiNewMultilineEntry(void)
|
||||||
{
|
{
|
||||||
uiMultilineEntry *e;
|
uiMultilineEntry *e;
|
||||||
|
|
||||||
e = (uiMultilineEntry *) uiNewControl(uiMultilineEntryType());
|
e = (uiMultilineEntry *) uiNewControl(uiMultilineEntry);
|
||||||
|
|
||||||
e->widget = gtk_scrolled_window_new(NULL, NULL);
|
e->widget = gtk_scrolled_window_new(NULL, NULL);
|
||||||
e->scontainer = GTK_CONTAINER(e->widget);
|
e->scontainer = GTK_CONTAINER(e->widget);
|
||||||
|
|
|
@ -22,7 +22,7 @@ uiProgressBar *uiNewProgressBar(void)
|
||||||
{
|
{
|
||||||
uiProgressBar *p;
|
uiProgressBar *p;
|
||||||
|
|
||||||
p = (uiProgressBar *) uiNewControl(uiProgressBarType());
|
p = (uiProgressBar *) uiNewControl(uiProgressBar);
|
||||||
|
|
||||||
p->widget = gtk_progress_bar_new();
|
p->widget = gtk_progress_bar_new();
|
||||||
p->pbar = GTK_PROGRESS_BAR(p->widget);
|
p->pbar = GTK_PROGRESS_BAR(p->widget);
|
||||||
|
|
|
@ -42,7 +42,7 @@ uiRadioButtons *uiNewRadioButtons(void)
|
||||||
{
|
{
|
||||||
uiRadioButtons *r;
|
uiRadioButtons *r;
|
||||||
|
|
||||||
r = (uiRadioButtons *) uiNewControl(uiRadioButtonsType());
|
r = (uiRadioButtons *) uiNewControl(uiRadioButtons);
|
||||||
|
|
||||||
r->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
r->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
|
||||||
r->container = GTK_CONTAINER(r->widget);
|
r->container = GTK_CONTAINER(r->widget);
|
||||||
|
|
|
@ -15,7 +15,7 @@ uiSeparator *uiNewHorizontalSeparator(void)
|
||||||
{
|
{
|
||||||
uiSeparator *s;
|
uiSeparator *s;
|
||||||
|
|
||||||
s = (uiSeparator *) uiNewControl(uiSeparatorType());
|
s = (uiSeparator *) uiNewControl(uiSeparator);
|
||||||
|
|
||||||
s->widget = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
|
s->widget = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
|
||||||
s->separator = GTK_SEPARATOR(s->widget);
|
s->separator = GTK_SEPARATOR(s->widget);
|
||||||
|
|
|
@ -50,7 +50,7 @@ uiSlider *uiNewSlider(intmax_t min, intmax_t max)
|
||||||
{
|
{
|
||||||
uiSlider *s;
|
uiSlider *s;
|
||||||
|
|
||||||
s = (uiSlider *) uiNewControl(uiSliderType());
|
s = (uiSlider *) uiNewControl(uiSlider);
|
||||||
|
|
||||||
s->widget = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, min, max, 1);
|
s->widget = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, min, max, 1);
|
||||||
s->range = GTK_RANGE(s->widget);
|
s->range = GTK_RANGE(s->widget);
|
||||||
|
|
|
@ -54,7 +54,7 @@ uiSpinbox *uiNewSpinbox(intmax_t min, intmax_t max)
|
||||||
if (min >= max)
|
if (min >= max)
|
||||||
complain("error: min >= max in uiNewSpinbox()");
|
complain("error: min >= max in uiNewSpinbox()");
|
||||||
|
|
||||||
s = (uiSpinbox *) uiNewControl(uiSpinboxType());
|
s = (uiSpinbox *) uiNewControl(uiSpinbox);
|
||||||
|
|
||||||
s->widget = gtk_spin_button_new_with_range(min, max, 1);
|
s->widget = gtk_spin_button_new_with_range(min, max, 1);
|
||||||
s->entry = GTK_ENTRY(s->widget);
|
s->entry = GTK_ENTRY(s->widget);
|
||||||
|
|
|
@ -86,7 +86,7 @@ uiTab *uiNewTab(void)
|
||||||
{
|
{
|
||||||
uiTab *t;
|
uiTab *t;
|
||||||
|
|
||||||
t = (uiTab *) uiNewControl(uiTabType());
|
t = (uiTab *) uiNewControl(uiTab);
|
||||||
|
|
||||||
t->widget = gtk_notebook_new();
|
t->widget = gtk_notebook_new();
|
||||||
t->container = GTK_CONTAINER(t->widget);
|
t->container = GTK_CONTAINER(t->widget);
|
||||||
|
|
|
@ -121,7 +121,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||||
{
|
{
|
||||||
uiWindow *w;
|
uiWindow *w;
|
||||||
|
|
||||||
w = (uiWindow *) uiNewControl(uiWindowType());
|
w = (uiWindow *) uiNewControl(uiWindow);
|
||||||
|
|
||||||
w->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
w->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
w->container = GTK_CONTAINER(w->widget);
|
w->container = GTK_CONTAINER(w->widget);
|
||||||
|
|
Loading…
Reference in New Issue