From cfa09ecba06ff424f8dd059d03ee2122a30c2dc0 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 17 Nov 2015 19:33:22 -0500 Subject: [PATCH] Wrote some of the boilerplate. Now we can get to the meat of the matter. --- haiku/GNUmakeinc.mk | 5 ++++- haiku/control.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ haiku/text.cpp | 15 +++++++++++++++ haiku/util.cpp | 17 +++++++++++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 haiku/control.cpp create mode 100644 haiku/text.cpp create mode 100644 haiku/util.cpp diff --git a/haiku/GNUmakeinc.mk b/haiku/GNUmakeinc.mk index b3d47df3..29e77c93 100644 --- a/haiku/GNUmakeinc.mk +++ b/haiku/GNUmakeinc.mk @@ -2,7 +2,10 @@ CXXFILES += \ haiku/alloc.cpp \ - haiku/main.cpp + haiku/control.cpp \ + haiku/main.cpp \ + haiku/text.cpp \ + haiku/util.cpp HFILES += \ haiku/uipriv_haiku.hpp diff --git a/haiku/control.cpp b/haiku/control.cpp new file mode 100644 index 00000000..aeaa65ec --- /dev/null +++ b/haiku/control.cpp @@ -0,0 +1,43 @@ +// 16 august 2015 +#include "uipriv_haiku.hpp" + +static uintmax_t type_uiHaikuControl = 0; + +uintmax_t uiHaikuControlType(void) +{ + if (type_uiHaikuControl == 0) + type_uiHaikuControl = uiRegisterType("uiHaikuControl", uiControlType(), sizeof (uiHaikuControl)); + return type_uiHaikuControl; +} + +static void defaultCommitShow(uiControl *c) +{ + BView *view; + + view = (BView *) uiControlHandle(c); + view->Show(); +} + +static void defaultCommitHide(uiControl *c) +{ + BView *view; + + view = (BView *) uiControlHandle(c); + view->Hide(); +} + +void osCommitEnable(uiControl *c) +{ + // TODO this might need to be per-widget +} + +void osCommitDisable(uiControl *c) +{ + // TODO this might need to be per-widget +} + +void uiHaikuFinishControl(uiControl *c) +{ + c->CommitShow = defaultCommitShow; + c->CommitHide = defaultCommitHide; +} diff --git a/haiku/text.cpp b/haiku/text.cpp new file mode 100644 index 00000000..d4782e3a --- /dev/null +++ b/haiku/text.cpp @@ -0,0 +1,15 @@ +// 9 april 2015 +#include +#include +#include "uipriv_haiku.hpp" +using namespace std; + +char *uiHaikuStrdupText(const char *t) +{ + return strdup(t); +} + +void uiFreeText(char *t) +{ + free(t); +} diff --git a/haiku/util.cpp b/haiku/util.cpp new file mode 100644 index 00000000..6ebe6900 --- /dev/null +++ b/haiku/util.cpp @@ -0,0 +1,17 @@ +// 7 april 2015 +#include +#include +#include "uipriv_haiku.hpp" +using namespace std; + +void complain(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + fprintf(stderr, "[libui] "); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); + abort(); +}