TODO consolidation.

This commit is contained in:
Pietro Gagliardi 2015-05-02 14:58:29 -04:00
parent 5d28ffd334
commit 57bc11d67c
4 changed files with 4 additions and 8 deletions

View File

@ -35,6 +35,10 @@
- make sure complain()s don't have \n at the end; add one on each platform - make sure complain()s don't have \n at the end; add one on each platform
- add a `[libui]` to the beginning of the message - add a `[libui]` to the beginning of the message
- figure out what to do on Windows and GTK+ if we don't have menus but the user wants a menubar (zero-height widget? don't bother? complain?) - figure out what to do on Windows and GTK+ if we don't have menus but the user wants a menubar (zero-height widget? don't bother? complain?)
- bin.c
- find a way to consolidate the duplicate code across OSs
- find a way to move the has parent check at the beginning of binDestroy()
- determine whether or not margins count in preferredSize() when there is no main control
ultimately: ultimately:
- add some sort of runtime type checking - add some sort of runtime type checking

View File

@ -15,7 +15,6 @@ void binDestroy(uiControl *c)
{ {
struct bin *b = (struct bin *) c; struct bin *b = (struct bin *) c;
// TODO find a way to move the parented check here
// we can't check for an OS parent here because what we're working with with bin isn't subviews but rather content views (at least I think... TODO) // we can't check for an OS parent here because what we're working with with bin isn't subviews but rather content views (at least I think... TODO)
// don't chain up to base here; we need to destroy children ourselves first // don't chain up to base here; we need to destroy children ourselves first
if (b->mainControl != NULL) { if (b->mainControl != NULL) {
@ -32,7 +31,6 @@ void binPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *heig
struct bin *b = (struct bin *) c; struct bin *b = (struct bin *) c;
intmax_t marginX, marginY; intmax_t marginX, marginY;
// TODO have the margins count even if no control?
if (b->mainControl == NULL) { if (b->mainControl == NULL) {
*width = 0; *width = 0;
*height = 0; *height = 0;

View File

@ -1,8 +1,6 @@
// 28 april 2015 // 28 april 2015
#include "uipriv_unix.h" #include "uipriv_unix.h"
// TODO find a way to consolidate duplicate code across OSs
struct bin { struct bin {
uiContainer c; uiContainer c;
void (*baseDestroy)(uiControl *); void (*baseDestroy)(uiControl *);
@ -18,7 +16,6 @@ void binDestroy(uiControl *c)
struct bin *b = (struct bin *) c; struct bin *b = (struct bin *) c;
GtkWidget *binWidget; GtkWidget *binWidget;
// TODO find a way to move the parented check here
// ensure clean removal by making sure the bin has no OS parent // ensure clean removal by making sure the bin has no OS parent
binWidget = GTK_WIDGET(uiControlHandle(uiControl(b))); binWidget = GTK_WIDGET(uiControlHandle(uiControl(b)));
if (gtk_widget_get_parent(binWidget) != NULL) if (gtk_widget_get_parent(binWidget) != NULL)
@ -38,7 +35,6 @@ void binPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *heig
struct bin *b = (struct bin *) c; struct bin *b = (struct bin *) c;
intmax_t marginX, marginY; intmax_t marginX, marginY;
// TODO have the margins count even if no control?
if (b->mainControl == NULL) { if (b->mainControl == NULL) {
*width = 0; *width = 0;
*height = 0; *height = 0;

View File

@ -16,7 +16,6 @@ void binDestroy(uiControl *c)
struct bin *b = (struct bin *) c; struct bin *b = (struct bin *) c;
HWND hwnd; HWND hwnd;
// TODO find a way to move the parented check here
// ensure clean removal by making sure the bin has no OS parent // ensure clean removal by making sure the bin has no OS parent
hwnd = (HWND) uiControlHandle(uiControl(b)); hwnd = (HWND) uiControlHandle(uiControl(b));
if (GetAncestor(hwnd, GA_PARENT) != NULL) if (GetAncestor(hwnd, GA_PARENT) != NULL)
@ -36,7 +35,6 @@ void binPreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *heig
struct bin *b = (struct bin *) c; struct bin *b = (struct bin *) c;
intmax_t marginX, marginY; intmax_t marginX, marginY;
// TODO have the margins count even if no control?
if (b->mainControl == NULL) { if (b->mainControl == NULL) {
*width = 0; *width = 0;
*height = 0; *height = 0;