From a11e939b340806c6832497d8d27bbd930a333447 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 4 May 2016 23:28:46 -0400 Subject: [PATCH] Wrote the finishing touches on the dptwidget.c needed for the final date-time picker. --- _wip/gtkdtp/dtpwidget.c | 43 +++++++++++++++++++++++++++++++++++++---- unix/datetimepicker.c | 8 -------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/_wip/gtkdtp/dtpwidget.c b/_wip/gtkdtp/dtpwidget.c index c6414989..a915c3cc 100644 --- a/_wip/gtkdtp/dtpwidget.c +++ b/_wip/gtkdtp/dtpwidget.c @@ -1,5 +1,5 @@ // 4 september 2015 -#include "dtp.h" +#include "uipriv_unix.h" // TODO imitate gnome-calendar's day/month/year entries? // TODO 24-hour time @@ -501,7 +501,7 @@ static void dateTimePickerWidget_class_init(dateTimePickerWidgetClass *class) G_OBJECT_CLASS(class)->finalize = dateTimePickerWidget_finalize; } -GtkWidget *newDTP(void) +static GtkWidget *newDTP(void) { GtkWidget *w; @@ -510,7 +510,7 @@ GtkWidget *newDTP(void) return w; } -GtkWidget *newDP(void) +static GtkWidget *newDP(void) { GtkWidget *w; @@ -520,7 +520,7 @@ GtkWidget *newDP(void) return w; } -GtkWidget *newTP(void) +static GtkWidget *newTP(void) { GtkWidget *w; @@ -529,3 +529,38 @@ GtkWidget *newTP(void) setLabel(dateTimePickerWidget(w)); return w; } + +struct uiDateTimePicker { + uiUnixControl c; + GtkWidget *widget; + dateTimePickerWidget *d; +}; + +uiUnixControlAllDefaults(uiDateTimePicker) + +uiDateTimePicker *finishNewDateTimePicker(GtkWidget (*fn)(void)) +{ + uiDateTimePicker *d; + + uiUnixNewControl(uiDateTimePicker, d); + + d->widget = (*fn)(); + d->d = dateTimePickerWidget(d->widget); + + return d; +} + +uiDateTimePicker *uiNewDateTimePicker(void) +{ + return finishNewDateTimePicker(newDTP); +} + +uiDateTimePicker *uiNewDatePicker(void) +{ + return finishNewDateTimePicker(newDP); +} + +uiDateTimePicker *uiNewTimePicker(void) +{ + return finishNewDateTimePicker(newTP); +} diff --git a/unix/datetimepicker.c b/unix/datetimepicker.c index 18b15e28..6a28eaf3 100644 --- a/unix/datetimepicker.c +++ b/unix/datetimepicker.c @@ -8,14 +8,6 @@ struct uiDateTimePicker { uiUnixControlAllDefaults(uiDateTimePicker) -// TODO -typedef int OSTHING; -enum { - OSARGDATETIME, - OSARGDATEONLY, - OSARGTIMEONLY, -}; - uiDateTimePicker *finishNewDateTimePicker(OSTHING OSARG) { uiDateTimePicker *d;