Wrote some of the boilerplate. Now we can get to the meat of the matter.

This commit is contained in:
Pietro Gagliardi 2015-11-17 19:33:22 -05:00
parent 2a42511c5c
commit cfa09ecba0
4 changed files with 79 additions and 1 deletions

View File

@ -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

43
haiku/control.cpp Normal file
View File

@ -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;
}

15
haiku/text.cpp Normal file
View File

@ -0,0 +1,15 @@
// 9 april 2015
#include <cstdlib>
#include <cstring>
#include "uipriv_haiku.hpp"
using namespace std;
char *uiHaikuStrdupText(const char *t)
{
return strdup(t);
}
void uiFreeText(char *t)
{
free(t);
}

17
haiku/util.cpp Normal file
View File

@ -0,0 +1,17 @@
// 7 april 2015
#include <cstdio>
#include <cstdlib>
#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();
}