Started the process of splitting the table code into a separate branch.
This commit is contained in:
parent
287d59b5c5
commit
e3dec183aa
|
@ -1,5 +1,3 @@
|
|||
# Note: Table stuff is currently experimental; do not use in production code. It will not build on Windows as that part has not been written yet; if you want to test other parts of the Windows code, apply `nowintable.diff`.
|
||||
|
||||
# libui: a portable GUI library for C
|
||||
|
||||
This README is being written.<br>
|
||||
|
@ -7,6 +5,9 @@ This README is being written.<br>
|
|||
|
||||
## Announcements
|
||||
|
||||
* **27 November 2016**
|
||||
* Decided to split the table stuff into its own branch. It will be developed independently of everything else, along with a few other features.
|
||||
|
||||
* **2 November 2016**
|
||||
* Added two new functions to replace the deleted `uiWindowPosition()` and friends: `uiAreaBeginUserWindowMove()` and `uiAreaBeginUserWindowResize()`. When used in a `uiAreaHandler.Mouse()` event handler, these let you initiate a user-driven mouse move or mouse resize of the window at any point in a uiArea.
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ list(APPEND _LIBUI_SOURCES
|
|||
common/debug.c
|
||||
common/matrix.c
|
||||
common/shouldquit.c
|
||||
common/table.c
|
||||
common/userbugs.c
|
||||
)
|
||||
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
// 21 june 2016
|
||||
#include "../ui.h"
|
||||
#include "uipriv.h"
|
||||
|
||||
void *uiTableModelGiveInt(int i)
|
||||
{
|
||||
return (void *) ((intptr_t) i);
|
||||
}
|
||||
|
||||
int uiTableModelTakeInt(void *v)
|
||||
{
|
||||
return (int) ((intptr_t) v);
|
||||
}
|
||||
|
||||
uiTableColumn *uiTableAppendTextColumn(uiTable *t, const char *name, int modelColumn)
|
||||
{
|
||||
uiTableColumn *tc;
|
||||
|
||||
tc = uiTableAppendColumn(t, name);
|
||||
uiTableColumnAppendTextPart(tc, modelColumn, 1);
|
||||
return tc;
|
||||
}
|
|
@ -35,7 +35,6 @@ list(APPEND _LIBUI_SOURCES
|
|||
darwin/spinbox.m
|
||||
darwin/stddialogs.m
|
||||
darwin/tab.m
|
||||
darwin/table.m
|
||||
darwin/text.m
|
||||
darwin/util.m
|
||||
darwin/window.m
|
||||
|
|
581
darwin/table.m
581
darwin/table.m
|
@ -1,581 +0,0 @@
|
|||
// 21 june 2016
|
||||
#import "uipriv_darwin.h"
|
||||
|
||||
// TODOs
|
||||
// - initial state of table view is off
|
||||
// - header cell seems off
|
||||
// - background color shows up for a line or two below selection
|
||||
// - editable NSTextFields have no intrinsic width
|
||||
// - changing a part property does not refresh views
|
||||
// - is the Y position of checkbox cells correct?
|
||||
// - progressbars appear ABOVE the table header
|
||||
|
||||
// LONGTERM
|
||||
// - reuse row views instead of creating a new one each time
|
||||
|
||||
@interface tableModel : NSObject<NSTableViewDataSource, NSTableViewDelegate> {
|
||||
uiTableModel *libui_m;
|
||||
}
|
||||
- (id)initWithModel:(uiTableModel *)m;
|
||||
- (IBAction)onAction:(id)sender;
|
||||
@end
|
||||
|
||||
enum {
|
||||
partText,
|
||||
partImage,
|
||||
partButton,
|
||||
partCheckbox,
|
||||
partProgressBar,
|
||||
};
|
||||
|
||||
@interface tablePart : NSObject
|
||||
@property int type;
|
||||
@property int textColumn;
|
||||
@property int textColorColumn;
|
||||
@property int imageColumn;
|
||||
@property int valueColumn;
|
||||
@property int expand;
|
||||
@property int editable;
|
||||
- (NSView *)mkView:(uiTableModel *)m row:(int)row;
|
||||
@end
|
||||
|
||||
@interface tableColumn : NSTableColumn
|
||||
@property uiTableColumn *libui_col;
|
||||
@end
|
||||
|
||||
@interface tableView : NSTableView
|
||||
@property uiTable *libui_t;
|
||||
@end
|
||||
|
||||
struct uiTableModel {
|
||||
uiTableModelHandler *mh;
|
||||
tableModel *m;
|
||||
NSMutableArray *tables;
|
||||
};
|
||||
|
||||
struct uiTableColumn {
|
||||
tableColumn *c;
|
||||
NSMutableArray *parts;
|
||||
};
|
||||
|
||||
struct uiTable {
|
||||
uiDarwinControl c;
|
||||
NSScrollView *sv;
|
||||
tableView *tv;
|
||||
struct scrollViewData *d;
|
||||
int backgroundColumn;
|
||||
};
|
||||
|
||||
@implementation tableModel
|
||||
|
||||
- (id)initWithModel:(uiTableModel *)m
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
self->libui_m = m;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tv
|
||||
{
|
||||
uiTableModelHandler *mh = self->libui_m->mh;
|
||||
|
||||
return (*(mh->NumRows))(mh, self->libui_m);
|
||||
}
|
||||
|
||||
// these are according to Interface Builder
|
||||
#define xleft 2
|
||||
#define xmiddle 7 /* between images and text, anyway; let's just use it for everything to be simpler */
|
||||
#define xright 3
|
||||
|
||||
- (NSView *)tableView:(NSTableView *)tv viewForTableColumn:(NSTableColumn *)cc row:(NSInteger)row
|
||||
{
|
||||
NSTableCellView *v;
|
||||
tableColumn *c = (tableColumn *) cc;
|
||||
tablePart *part;
|
||||
NSMutableArray *views;
|
||||
NSView *view, *prev;
|
||||
|
||||
v = [[NSTableCellView alloc] initWithFrame:NSZeroRect];
|
||||
|
||||
views = [NSMutableArray new];
|
||||
for (part in c.libui_col->parts)
|
||||
[views addObject:[part mkView:self->libui_m row:row]];
|
||||
if ([views count] == 0) // empty (TODO allow?)
|
||||
goto done;
|
||||
|
||||
// add to v and arrange horizontally
|
||||
prev = nil;
|
||||
for (view in views) {
|
||||
[v addSubview:view];
|
||||
// TODO set [v imageView] and [v textField] as appropriate?
|
||||
if (prev == nil) { // first view
|
||||
[v addConstraint:mkConstraint(v, NSLayoutAttributeLeading,
|
||||
NSLayoutRelationEqual,
|
||||
view, NSLayoutAttributeLeading,
|
||||
1, -xleft,
|
||||
@"uiTableColumn first part horizontal constraint")];
|
||||
prev = view;
|
||||
continue;
|
||||
}
|
||||
[v addConstraint:mkConstraint(prev, NSLayoutAttributeTrailing,
|
||||
NSLayoutRelationEqual,
|
||||
view, NSLayoutAttributeLeading,
|
||||
1, -xmiddle,
|
||||
@"uiTableColumn middle horizontal constraint")];
|
||||
prev = view;
|
||||
}
|
||||
[v addConstraint:mkConstraint(prev, NSLayoutAttributeTrailing,
|
||||
NSLayoutRelationEqual,
|
||||
v, NSLayoutAttributeTrailing,
|
||||
1, -xright,
|
||||
@"uiTableColumn last part horizontal constraint")];
|
||||
|
||||
// and vertically
|
||||
for (view in views) {
|
||||
[v addConstraint:mkConstraint(view, NSLayoutAttributeCenterY,
|
||||
NSLayoutRelationEqual,
|
||||
v, NSLayoutAttributeCenterY,
|
||||
1, 0,
|
||||
@"uiTableColumn part vertical constraint")];
|
||||
// TODO avoid the need for this hack
|
||||
if ([view isKindOfClass:[NSImageView class]])
|
||||
[v addConstraint:mkConstraint(view, NSLayoutAttributeTop,
|
||||
NSLayoutRelationEqual,
|
||||
v, NSLayoutAttributeTop,
|
||||
1, 0,
|
||||
@"uiTableColumn part vertical top constraint")];
|
||||
}
|
||||
|
||||
done:
|
||||
[views release];
|
||||
[v setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
// TODO autorelease?
|
||||
return v;
|
||||
}
|
||||
|
||||
- (void)tableView:(NSTableView *)nstv didAddRowView:(NSTableRowView *)rv forRow:(NSInteger)row
|
||||
{
|
||||
uiTableModel *m = self->libui_m;
|
||||
tableView *tv = (tableView *) nstv;
|
||||
uiTable *t = tv.libui_t;
|
||||
NSColor *color;
|
||||
|
||||
if (t->backgroundColumn == -1)
|
||||
return;
|
||||
color = (NSColor *) ((*(m->mh->CellValue))(m->mh, m, row, t->backgroundColumn));
|
||||
if (color == nil)
|
||||
return;
|
||||
[rv setBackgroundColor:color];
|
||||
// TODO autorelease color? or release it?
|
||||
}
|
||||
|
||||
- (IBAction)onAction:(id)sender
|
||||
{
|
||||
uiTableModel *m = self->libui_m;
|
||||
NSView *view = (NSView *) sender;
|
||||
NSTableView *tv;
|
||||
NSInteger row;
|
||||
const void *data;
|
||||
|
||||
row = -1;
|
||||
for (tv in m->tables) {
|
||||
row = [tv rowForView:view];
|
||||
if (row != -1)
|
||||
break;
|
||||
}
|
||||
if (row == -1)
|
||||
implbug("table model action triggered on view with no associated table");
|
||||
|
||||
if ([view isKindOfClass:[NSTextField class]])
|
||||
data = [[((NSTextField *) view) stringValue] UTF8String];
|
||||
else if ([view isKindOfClass:[NSButton class]]) {
|
||||
NSButton *b;
|
||||
|
||||
b = (NSButton *) view;
|
||||
// if ([b buttonType] == NSSwitchButton)
|
||||
data = uiTableModelGiveInt([b state] == NSOnState);
|
||||
// TODO there is no buttonType getter
|
||||
if(1); else
|
||||
data = NULL;
|
||||
} else
|
||||
implbug("table model editing action triggered on non-editable view");
|
||||
|
||||
// note the use of [view tag] — we need the model column, which we store in the view tag for relevant views below
|
||||
(*(m->mh->SetCellValue))(m->mh, m,
|
||||
row, [view tag],
|
||||
data);
|
||||
// always refresh the value in case the model rejected it
|
||||
// TODO only affect tv?
|
||||
uiTableModelRowChanged(m, row);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation tablePart
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.textColumn = -1;
|
||||
self.textColorColumn = -1;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSView *)mkView:(uiTableModel *)m row:(int)row
|
||||
{
|
||||
void *data;
|
||||
NSString *str;
|
||||
NSView *view;
|
||||
NSTextField *tf;
|
||||
NSImageView *iv;
|
||||
NSButton *b;
|
||||
NSProgressIndicator *p;
|
||||
int value;
|
||||
|
||||
switch (self.type) {
|
||||
case partText:
|
||||
data = (*(m->mh->CellValue))(m->mh, m, row, self.textColumn);
|
||||
str = toNSString((char *) data);
|
||||
uiFree(data);
|
||||
tf = newLabel(str);
|
||||
// TODO set wrap and ellipsize modes?
|
||||
if (self.textColorColumn != -1) {
|
||||
NSColor *color;
|
||||
|
||||
color = (NSColor *) ((*(m->mh->CellValue))(m->mh, m, row, self.textColorColumn));
|
||||
if (color != nil)
|
||||
[tf setTextColor:color];
|
||||
// TODO release color
|
||||
}
|
||||
if (self.editable) {
|
||||
[tf setEditable:YES];
|
||||
[tf setTarget:m->m];
|
||||
[tf setAction:@selector(onAction:)];
|
||||
}
|
||||
[tf setTag:self.textColumn];
|
||||
view = tf;
|
||||
break;
|
||||
case partImage:
|
||||
data = (*(m->mh->CellValue))(m->mh, m, row, self.imageColumn);
|
||||
iv = [[NSImageView alloc] initWithFrame:NSZeroRect];
|
||||
[iv setImage:imageImage((uiImage *) data)];
|
||||
[iv setImageFrameStyle:NSImageFrameNone];
|
||||
[iv setImageAlignment:NSImageAlignCenter];
|
||||
[iv setImageScaling:NSImageScaleProportionallyDown];
|
||||
[iv setAnimates:NO];
|
||||
[iv setEditable:NO];
|
||||
[iv addConstraint:mkConstraint(iv, NSLayoutAttributeWidth,
|
||||
NSLayoutRelationEqual,
|
||||
iv, NSLayoutAttributeHeight,
|
||||
1, 0,
|
||||
@"uiTable image squareness constraint")];
|
||||
[iv setTag:self.imageColumn];
|
||||
view = iv;
|
||||
break;
|
||||
case partButton:
|
||||
// TODO buttons get clipped
|
||||
data = (*(m->mh->CellValue))(m->mh, m, row, self.textColumn);
|
||||
str = toNSString((char *) data);
|
||||
b = [[NSButton alloc] initWithFrame:NSZeroRect];
|
||||
[b setTitle:str];
|
||||
[b setButtonType:NSMomentaryPushInButton];
|
||||
[b setBordered:YES];
|
||||
[b setBezelStyle:NSRoundRectBezelStyle];
|
||||
uiDarwinSetControlFont(b, NSRegularControlSize);
|
||||
if (self.editable) {
|
||||
[b setTarget:m->m];
|
||||
[b setAction:@selector(onAction:)];
|
||||
} else
|
||||
[b setEnabled:NO];
|
||||
[b setTag:self.textColumn];
|
||||
view = b;
|
||||
break;
|
||||
case partCheckbox:
|
||||
data = (*(m->mh->CellValue))(m->mh, m, row, self.valueColumn);
|
||||
b = [[NSButton alloc] initWithFrame:NSZeroRect];
|
||||
[b setTitle:@""];
|
||||
[b setButtonType:NSSwitchButton];
|
||||
// doesn't seem to have an associated bezel style
|
||||
[b setBordered:NO];
|
||||
[b setTransparent:NO];
|
||||
uiDarwinSetControlFont(b, NSRegularControlSize);
|
||||
if (uiTableModelTakeInt(data) != 0)
|
||||
[b setState:NSOnState];
|
||||
else
|
||||
[b setState:NSOffState];
|
||||
if (self.editable) {
|
||||
[b setTarget:m->m];
|
||||
[b setAction:@selector(onAction:)];
|
||||
} else
|
||||
[b setEnabled:NO];
|
||||
[b setTag:self.valueColumn];
|
||||
view = b;
|
||||
break;
|
||||
case partProgressBar:
|
||||
data = (*(m->mh->CellValue))(m->mh, m, row, self.valueColumn);
|
||||
value = uiTableModelTakeInt(data);
|
||||
// TODO no intrinsic width
|
||||
p = [[NSProgressIndicator alloc] initWithFrame:NSZeroRect];
|
||||
[p setControlSize:NSRegularControlSize];
|
||||
[p setBezeled:YES];
|
||||
[p setStyle:NSProgressIndicatorBarStyle];
|
||||
if (value == -1) {
|
||||
[p setIndeterminate:YES];
|
||||
[p startAnimation:p];
|
||||
} else if (value == 100) {
|
||||
[p setIndeterminate:NO];
|
||||
[p setMaxValue:101];
|
||||
[p setDoubleValue:101];
|
||||
[p setDoubleValue:100];
|
||||
[p setMaxValue:100];
|
||||
} else {
|
||||
[p setIndeterminate:NO];
|
||||
[p setDoubleValue:(value + 1)];
|
||||
[p setDoubleValue:value];
|
||||
}
|
||||
view = p;
|
||||
break;
|
||||
}
|
||||
|
||||
// if stretchy, don't hug, otherwise hug forcibly
|
||||
if (self.expand)
|
||||
[view setContentHuggingPriority:NSLayoutPriorityDefaultLow forOrientation:NSLayoutConstraintOrientationHorizontal];
|
||||
else
|
||||
[view setContentHuggingPriority:NSLayoutPriorityRequired forOrientation:NSLayoutConstraintOrientationHorizontal];
|
||||
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
// TODO autorelease?
|
||||
return view;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation tableColumn
|
||||
@end
|
||||
|
||||
@implementation tableView
|
||||
@end
|
||||
|
||||
void *uiTableModelStrdup(const char *str)
|
||||
{
|
||||
// TODO don't we have this already?
|
||||
char *dup;
|
||||
|
||||
dup = (char *) uiAlloc((strlen(str) + 1) * sizeof (char), "char[]");
|
||||
strcpy(dup, str);
|
||||
return dup;
|
||||
}
|
||||
|
||||
uiTableModel *uiNewTableModel(uiTableModelHandler *mh)
|
||||
{
|
||||
uiTableModel *m;
|
||||
|
||||
m = uiNew(uiTableModel);
|
||||
m->mh = mh;
|
||||
m->m = [[tableModel alloc] initWithModel:m];
|
||||
m->tables = [NSMutableArray new];
|
||||
return m;
|
||||
}
|
||||
|
||||
void *uiTableModelGiveColor(double r, double g, double b, double a)
|
||||
{
|
||||
return [[NSColor colorWithSRGBRed:r green:g blue:b alpha:a] retain];
|
||||
}
|
||||
|
||||
void uiFreeTableModel(uiTableModel *m)
|
||||
{
|
||||
if ([m->tables count] != 0)
|
||||
userbug("You cannot free a uiTableModel while uiTables are using it.");
|
||||
[m->tables release];
|
||||
[m->m release];
|
||||
uiFree(m);
|
||||
}
|
||||
|
||||
void uiTableModelRowInserted(uiTableModel *m, int newIndex)
|
||||
{
|
||||
NSTableView *tv;
|
||||
NSIndexSet *set;
|
||||
|
||||
set = [NSIndexSet indexSetWithIndex:newIndex];
|
||||
for (tv in m->tables)
|
||||
[tv insertRowsAtIndexes:set withAnimation:NSTableViewAnimationEffectNone];
|
||||
// set is autoreleased
|
||||
}
|
||||
|
||||
void uiTableModelRowChanged(uiTableModel *m, int index)
|
||||
{
|
||||
NSTableView *tv;
|
||||
NSIndexSet *set, *cols;
|
||||
|
||||
set = [NSIndexSet indexSetWithIndex:index];
|
||||
for (tv in m->tables) {
|
||||
cols = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(0, [[tv tableColumns] count])];
|
||||
[tv reloadDataForRowIndexes:set columnIndexes:cols];
|
||||
// TODO this isn't enough
|
||||
[cols release];
|
||||
}
|
||||
// set is autoreleased
|
||||
}
|
||||
|
||||
void uiTableModelRowDeleted(uiTableModel *m, int oldIndex)
|
||||
{
|
||||
NSTableView *tv;
|
||||
NSIndexSet *set;
|
||||
|
||||
set = [NSIndexSet indexSetWithIndex:oldIndex];
|
||||
for (tv in m->tables)
|
||||
[tv removeRowsAtIndexes:set withAnimation:NSTableViewAnimationEffectNone];
|
||||
// set is autoreleased
|
||||
}
|
||||
|
||||
void uiTableColumnAppendTextPart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
tablePart *part;
|
||||
|
||||
part = [tablePart new];
|
||||
part.type = partText;
|
||||
part.textColumn = modelColumn;
|
||||
part.expand = expand;
|
||||
[c->parts addObject:part];
|
||||
}
|
||||
|
||||
void uiTableColumnAppendImagePart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
tablePart *part;
|
||||
|
||||
part = [tablePart new];
|
||||
part.type = partImage;
|
||||
part.imageColumn = modelColumn;
|
||||
part.expand = expand;
|
||||
[c->parts addObject:part];
|
||||
}
|
||||
|
||||
void uiTableColumnAppendButtonPart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
tablePart *part;
|
||||
|
||||
part = [tablePart new];
|
||||
part.type = partButton;
|
||||
part.textColumn = modelColumn;
|
||||
part.expand = expand;
|
||||
part.editable = 1; // editable by default
|
||||
[c->parts addObject:part];
|
||||
}
|
||||
|
||||
void uiTableColumnAppendCheckboxPart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
tablePart *part;
|
||||
|
||||
part = [tablePart new];
|
||||
part.type = partCheckbox;
|
||||
part.valueColumn = modelColumn;
|
||||
part.expand = expand;
|
||||
part.editable = 1; // editable by default
|
||||
[c->parts addObject:part];
|
||||
}
|
||||
|
||||
void uiTableColumnAppendProgressBarPart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
tablePart *part;
|
||||
|
||||
part = [tablePart new];
|
||||
part.type = partProgressBar;
|
||||
part.valueColumn = modelColumn;
|
||||
part.expand = expand;
|
||||
[c->parts addObject:part];
|
||||
}
|
||||
|
||||
void uiTableColumnPartSetEditable(uiTableColumn *c, int part, int editable)
|
||||
{
|
||||
tablePart *p;
|
||||
|
||||
p = (tablePart *) [c->parts objectAtIndex:part];
|
||||
p.editable = editable;
|
||||
}
|
||||
|
||||
void uiTableColumnPartSetTextColor(uiTableColumn *c, int part, int modelColumn)
|
||||
{
|
||||
tablePart *p;
|
||||
|
||||
p = (tablePart *) [c->parts objectAtIndex:part];
|
||||
p.textColorColumn = modelColumn;
|
||||
}
|
||||
|
||||
uiDarwinControlAllDefaultsExceptDestroy(uiTable, sv)
|
||||
|
||||
static void uiTableDestroy(uiControl *c)
|
||||
{
|
||||
uiTable *t = uiTable(c);
|
||||
|
||||
// TODO
|
||||
[t->sv release];
|
||||
uiFreeControl(uiControl(t));
|
||||
}
|
||||
|
||||
uiTableColumn *uiTableAppendColumn(uiTable *t, const char *name)
|
||||
{
|
||||
uiTableColumn *c;
|
||||
|
||||
c = uiNew(uiTableColumn);
|
||||
c->c = [[tableColumn alloc] initWithIdentifier:@""];
|
||||
c->c.libui_col = c;
|
||||
// via Interface Builder
|
||||
[c->c setResizingMask:(NSTableColumnAutoresizingMask | NSTableColumnUserResizingMask)];
|
||||
// 10.10 adds -[NSTableColumn setTitle:]; before then we have to do this
|
||||
[[c->c headerCell] setStringValue:toNSString(name)];
|
||||
// TODO is this sufficient?
|
||||
[[c->c headerCell] setFont:[NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
|
||||
c->parts = [NSMutableArray new];
|
||||
[t->tv addTableColumn:c->c];
|
||||
return c;
|
||||
}
|
||||
|
||||
void uiTableSetRowBackgroundColorModelColumn(uiTable *t, int modelColumn)
|
||||
{
|
||||
t->backgroundColumn = modelColumn;
|
||||
}
|
||||
|
||||
uiTable *uiNewTable(uiTableModel *model)
|
||||
{
|
||||
uiTable *t;
|
||||
struct scrollViewCreateParams p;
|
||||
|
||||
uiDarwinNewControl(uiTable, t);
|
||||
|
||||
t->tv = [[tableView alloc] initWithFrame:NSZeroRect];
|
||||
t->tv.libui_t = t;
|
||||
|
||||
[t->tv setDataSource:model->m];
|
||||
[t->tv setDelegate:model->m];
|
||||
[t->tv reloadData];
|
||||
[model->tables addObject:t->tv];
|
||||
|
||||
// TODO is this sufficient?
|
||||
[t->tv setAllowsColumnReordering:NO];
|
||||
[t->tv setAllowsColumnResizing:YES];
|
||||
[t->tv setAllowsMultipleSelection:NO];
|
||||
[t->tv setAllowsEmptySelection:YES];
|
||||
[t->tv setAllowsColumnSelection:NO];
|
||||
[t->tv setUsesAlternatingRowBackgroundColors:YES];
|
||||
[t->tv setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleRegular];
|
||||
[t->tv setGridStyleMask:NSTableViewGridNone];
|
||||
[t->tv setAllowsTypeSelect:YES];
|
||||
// TODO floatsGroupRows — do we even allow group rows?
|
||||
|
||||
memset(&p, 0, sizeof (struct scrollViewCreateParams));
|
||||
p.DocumentView = t->tv;
|
||||
// this is what Interface Builder sets it to
|
||||
// TODO verify
|
||||
p.BackgroundColor = [NSColor colorWithCalibratedWhite:1.0 alpha:1.0];
|
||||
p.DrawsBackground = YES;
|
||||
p.Bordered = YES;
|
||||
p.HScroll = YES;
|
||||
p.VScroll = YES;
|
||||
t->sv = mkScrollView(&p, &(t->d));
|
||||
|
||||
t->backgroundColumn = -1;
|
||||
|
||||
return t;
|
||||
}
|
|
@ -6,7 +6,6 @@ endif()
|
|||
|
||||
_add_exec(tester
|
||||
drawtests.c
|
||||
images.c
|
||||
main.c
|
||||
menus.c
|
||||
page1.c
|
||||
|
@ -27,7 +26,6 @@ _add_exec(tester
|
|||
page13.c
|
||||
page14.c
|
||||
page15.c
|
||||
page16.c
|
||||
spaced.c
|
||||
${_TEST_RESOURCES_RC}
|
||||
)
|
||||
|
|
202
test/images.c
202
test/images.c
|
@ -1,202 +0,0 @@
|
|||
// auto-generated by images/gen.go
|
||||
#include "test.h"
|
||||
|
||||
static const uint32_t dat0[] = {
|
||||
0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF8AC3FF, 0xFF8AC3FF, 0xFF8AC3FF, 0xFF8AC3FF, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C,
|
||||
};
|
||||
|
||||
static const uint32_t dat1[] = {
|
||||
0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC,
|
||||
0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFE560FC,
|
||||
0xFFE560FC, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFF4079, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF8AC3FF,
|
||||
0xFF8AC3FF, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFFFFFB43, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFF8AC3FF, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43,
|
||||
0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFFFFFB43, 0xFF8AC3FF, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C,
|
||||
0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C, 0xFF89C57C,
|
||||
};
|
||||
|
||||
static const uint32_t dat2[] = {
|
||||
0xAC676767, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0x562B2B2B, 0x00000000, 0x00000000,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF818181, 0x00000000, 0x00000000,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB7B7B7, 0xFFB7B7B7, 0xFFB7B7B8, 0xFF9E9E9F, 0xFFB8B8B8, 0xFFB8B8B8, 0xFF9F9F9F, 0xFFB8B8B9, 0xFFB8B8B9, 0xFF9F9F9F, 0xFFFFFFFF, 0xFF818181, 0x00000000, 0x00000000,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFF9E9E9E, 0xFF9F9F9E, 0xFF9F9F9F, 0xFF9F9F9F, 0xFF9F9F9F, 0xFF9F9F9F, 0xFF9F9F9F, 0xFF9F9F9F, 0xFF9F9F9F, 0xFF9F9F9F, 0xFFFFFFFF, 0xFF818181, 0x00000000, 0x00000000,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB7B8B7, 0xFFC3C3C3, 0xFFC3C3C3, 0xFF9F9F9F, 0xFFEEEEEE, 0xFFEEEEEE, 0xFFC2C2C2, 0xFFEEEFEE, 0xFFEFEEEF, 0xFFC2C2C2, 0xFFFFFFFF, 0xFF818181, 0x00000000, 0x00000000,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB1B1B1, 0xFFB8B8B8, 0xFFB9B8B9, 0xFF9F9F9F, 0xFFE0E0E0, 0xFFE0E1E0, 0xFFC2C2C2, 0xFFE1E0E0, 0xFFE1E1E1, 0xFFC2C2C2, 0xFFFFFFFF, 0xFF818181, 0x00000000, 0x00000000,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB9B8B8, 0xFFC4C4C4, 0xFFC3C4C4, 0xFF9F9F9F, 0xFFEEEEEF, 0xFFEFEEEF, 0xFFC2C2C2, 0xFFEFEFEF, 0xFFF0EFEF, 0xFFC2C2C2, 0xFFFFFFFF, 0xFF818181, 0x00000000, 0x00000000,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB1B1B1, 0xFFB9B9B8, 0xFFB9B9B9, 0xFF9F9F9F, 0xFFC9A6A5, 0xFFAE3A36, 0xFFA50F0C, 0xFFA40201, 0xFFA40201, 0xFFA40D0A, 0xFFB03B37, 0xFF8D6969, 0x00000000, 0x00000000,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB9B9B9, 0xFFC4C4C4, 0xFFC4C4C4, 0xFF9E403D, 0xFFA70A07, 0xFFC66453, 0xFFCB715C, 0xFFC9735D, 0xFFC5715B, 0xFFBF6C59, 0xFFC06E61, 0xFFAC201D, 0xC17E2927, 0x19191919,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB2B2B2, 0xFFB9B9B9, 0xFFA65C5B, 0xFFAF2017, 0xFFCB725D, 0xFFC7654D, 0xFFBB5338, 0xFFB65136, 0xFFB04E35, 0xFFB35D47, 0xFFAE5B45, 0xFFA95743, 0xFFAA2F28, 0xA1641716,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB9B9B9, 0xFFC4C4C4, 0xFFA51412, 0xFFCA6F5A, 0xFFBF5439, 0xFFBA5237, 0xFFB44F36, 0xFFAF4D34, 0xFF886556, 0xFF765F5A, 0xFF715B56, 0xFF6B5853, 0xFF77605B, 0xF7980C0B,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB2B2B2, 0xFFB9B9B9, 0xFFA40201, 0xFFC76951, 0xFFB85137, 0xFFB24E36, 0xFFAD4C34, 0xFFAE653A, 0xFF95995D, 0xFF1D84A0, 0xFF177F99, 0xFF3D91A5, 0xFF3B8EA0, 0xFFA20101,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFB9B9B9, 0xFFC4C4C4, 0xFF9F1212, 0xFFCA7E6D, 0xFFB85F48, 0xFFAB4C33, 0xFFA64932, 0xFFB18B44, 0xFFB8BC50, 0xFF358086, 0xFF509CAD, 0xFF278397, 0xFF496E77, 0xF7920808,
|
||||
0xFF818181, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFBC7878, 0xFF9C1D1A, 0xFFBD7E6D, 0xFFBE7F70, 0xFFBD8374, 0xFFCDC787, 0xFFCBD089, 0xFFB4B48A, 0xFF5C93A0, 0xFF44656D, 0xFF7B1618, 0xA1661D1D,
|
||||
0xB4696969, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF818181, 0xFF934040, 0xFF9E0605, 0xFF99463D, 0xFF9E624D, 0xFFA6A14C, 0xFF9F9B4A, 0xFF948845, 0xFF4B3C43, 0xFF9A0505, 0xBA771F1F, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x55351616, 0xD37F1717, 0xF99C0B0B, 0xFFA30201, 0xFFA20101, 0xF99C0B0B, 0xD3881E1E, 0x55412222, 0x00000000, 0x00000000,
|
||||
};
|
||||
|
||||
static const uint32_t dat3[] = {
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x52303030, 0xF2919191, 0xFF999999, 0xFF9C9C9C, 0xFF9E9E9E, 0xFF9C9C9C, 0xFF999999, 0xFF969696, 0xFF939393, 0xFF8F8F8F, 0xFF8C8C8C, 0xFF888888,
|
||||
0xFF848484, 0xFF818181, 0xFF7D7D7D, 0xFF7A7A7A, 0xFF767676, 0xFF727272, 0xFF6F6F6F, 0xFF6B6B6B, 0xFF686868, 0xFF646464, 0xF25F5F5F, 0x521E1E1E, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xEF8D8D8D, 0xFFFDFDFD, 0xFFFDFDFD, 0xFFFEFEFE, 0xFFFEFEFE, 0xFFFEFEFE, 0xFFFDFDFD, 0xFFFDFDFD, 0xFFFDFDFD, 0xFFFDFDFD, 0xFFFCFCFC, 0xFFFCFCFC,
|
||||
0xFFFCFCFC, 0xFFFBFBFB, 0xFFFBFBFB, 0xFFFBFBFB, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFFAFAFA, 0xFFF9F9F9, 0xFFF9F9F9, 0xFFF9F9F9, 0xFFF8F8F8, 0xEF5D5D5D, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF939393, 0xFFFDFDFD, 0xFFDCDCDC, 0xFFDDDDDD, 0xFFDEDEDE, 0xFFDEDEDE, 0xFFDFDFDF, 0xFFDFDFDF, 0xFFE0E0E0, 0xFFE1E1E1, 0xFFE1E1E1, 0xFFE1E1E1,
|
||||
0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE2E2E2, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE3E3E3, 0xFFE2E2E2, 0xFFF8F8F8, 0xFF5D5D5D, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF929292, 0xFFFEFEFE, 0xFFDDDDDD, 0xFF787878, 0xFF8D8D8D, 0xFF8E8E8E, 0xFF8F8F8F, 0xFF8F8F8F, 0xFF787878, 0xFF8F8F8F, 0xFF909090, 0xFF909090,
|
||||
0xFF7A7A7A, 0xFF919191, 0xFF919191, 0xFF919191, 0xFF7B7B7B, 0xFF919191, 0xFF919191, 0xFF919191, 0xFF7D7D7D, 0xFFE3E3E3, 0xFFF8F8F8, 0xFF5D5D5D, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF909090, 0xFFFEFEFE, 0xFFDEDEDE, 0xFF949494, 0xFFB0B0B0, 0xFFB1B1B1, 0xFFB1B1B1, 0xFFB1B1B1, 0xFF969696, 0xFFB2B2B2, 0xFFB3B3B3, 0xFFB3B3B3,
|
||||
0xFF989898, 0xFFB4B4B4, 0xFFB4B4B4, 0xFFB5B5B5, 0xFF999999, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFF999999, 0xFFE4E4E4, 0xFFF8F8F8, 0xFF5C5C5C, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF8E8E8E, 0xFFFDFDFD, 0xFFDFDFDF, 0xFF949494, 0xFFB1B1B1, 0xFFB1B1B1, 0xFFB2B2B2, 0xFFB2B2B2, 0xFF979797, 0xFFB3B3B3, 0xFFB4B4B4, 0xFFB4B4B4,
|
||||
0xFF999999, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFF999999, 0xFFB5B5B5, 0xFFB5B5B5, 0xFFB5B5B5, 0xFF999999, 0xFFE5E5E5, 0xFFF8F8F8, 0xFF5C5C5C, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF8B8B8B, 0xFFFDFDFD, 0xFFDFDFDF, 0xFF7A7A7A, 0xFF919191, 0xFF929292, 0xFF929292, 0xFF939393, 0xFF7D7D7D, 0xFF949494, 0xFF949494, 0xFF949494,
|
||||
0xFF7D7D7D, 0xFF949494, 0xFF949494, 0xFF959595, 0xFF7E7E7E, 0xFF959595, 0xFF959595, 0xFF959595, 0xFF7E7E7E, 0xFFE6E6E6, 0xFFF8F8F8, 0xFF5B5B5B, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF898989, 0xFFFDFDFD, 0xFFE0E0E0, 0xFF949494, 0xFFB0B0B0, 0xFFB0B0B0, 0xFFB1B1B1, 0xFFB2B2B2, 0xFF979797, 0xFFE2E2E2, 0xFFE3E3E3, 0xFFE3E3E3,
|
||||
0xFFC0C0C0, 0xFFE4E4E4, 0xFFE4E4E4, 0xFFE5E5E5, 0xFFC1C1C1, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFE5E5E5, 0xFFC1C1C1, 0xFFE8E8E8, 0xFFF8F8F8, 0xFF5A5A5A, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF868686, 0xFFFDFDFD, 0xFFE1E1E1, 0xFF7B7B7B, 0xFF929292, 0xFF939393, 0xFF949494, 0xFF949494, 0xFF7D7D7D, 0xFFBDBDBD, 0xFFBDBDBD, 0xFFBDBDBD,
|
||||
0xFFA0A0A0, 0xFFBEBEBE, 0xFFBEBEBE, 0xFFBFBFBF, 0xFFA1A1A1, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFBFBFBF, 0xFFA1A1A1, 0xFFE9E9E9, 0xFFF8F8F8, 0xFF595959, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF838383, 0xFFFDFDFD, 0xFFE1E1E1, 0xFF949494, 0xFFB1B1B1, 0xFFB2B2B2, 0xFFB3B3B3, 0xFFB3B3B3, 0xFF979797, 0xFFE4E4E4, 0xFFE5E5E5, 0xFFE5E5E5,
|
||||
0xFFC2C2C2, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE7E7E7, 0xFFC3C3C3, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFE7E7E7, 0xFFC3C3C3, 0xFFEAEAEA, 0xFFF8F8F8, 0xFF585858, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF808080, 0xFFFCFCFC, 0xFFE2E2E2, 0xFF7C7C7C, 0xFF949494, 0xFF949494, 0xFF949494, 0xFF949494, 0xFF7E7E7E, 0xFFBEBEBE, 0xFFBEBEBE, 0xFFBFBFBF,
|
||||
0xFFA2A2A2, 0xFFC0C0C0, 0xFFC0C0C0, 0xFFC1C1C1, 0xFFA3A3A3, 0xFFC1C1C1, 0xFFC1C1C1, 0xFFC1C1C1, 0xFFA3A3A3, 0xFFEBEBEB, 0xFFF8F8F8, 0xFF575757, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF7D7D7D, 0xFFFCFCFC, 0xFFE3E3E3, 0xFF969696, 0xFFB3B3B3, 0xFFB3B3B3, 0xFFB3B3B3, 0xFFB4B4B4, 0xFF999999, 0xFFE6E6E6, 0xFFE6E6E6, 0xFFE7E7E7,
|
||||
0xFFC4C4C4, 0xFFE8E8E8, 0xFFE8E8E8, 0xFFE9E9E9, 0xFFC4C4C4, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFE9E9E9, 0xFFC4C4C4, 0xFFECECEC, 0xFFF8F8F8, 0xFF555555, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF7A7A7A, 0xFFFCFCFC, 0xFFE3E3E3, 0xFF7D7D7D, 0xFF949494, 0xFF949494, 0xFF959595, 0xFF969696, 0xFF7F7F7F, 0xFFBFBFBF, 0xFFC0C0C0, 0xFFC1C1C1,
|
||||
0xFFA3A3A3, 0xFFC1C1C1, 0xFFC1C1C1, 0xFFC2C2C2, 0xFFA4A4A4, 0xFFC2C2C2, 0xFFC2C2C2, 0xFFC2C2C2, 0xFFA4A4A4, 0xFFEDEDED, 0xFFF8F8F8, 0xFF545454, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF777777, 0xFFFBFBFB, 0xFFE4E4E4, 0xFF979797, 0xFFB3B3B3, 0xFFB4B4B4, 0xFFB5B5B5, 0xFFB6B6B6, 0xFF999999, 0xFFE7E7E7, 0xFFE8E8E8, 0xFFE9E9E9,
|
||||
0xFFC4C4C4, 0xFFEAEAEA, 0xFFEAEAEA, 0xFFEBEBEB, 0xFFC6C6C6, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFEBEBEB, 0xFFC6C6C6, 0xFFEEEEEE, 0xFFF8F8F8, 0xFF525252, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF737373, 0xFFFBFBFB, 0xFFE4E4E4, 0xFF7D7D7D, 0xFF949494, 0xFF959595, 0xFF969696, 0xFF979797, 0xFF7F7F7F, 0xFFC1C1C1, 0xFFC1C1C1, 0xFFC2C2C2,
|
||||
0xFFA3A2A2, 0xFFAB9191, 0xFF946060, 0xFF843D3D, 0xFF782525, 0xFF802727, 0xFF7E2B2B, 0xFF843D3D, 0xFF865252, 0xFFCCB2B2, 0xFFF6F5F5, 0xFF505050, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF707070, 0xFFFBFBFB, 0xFFE5E5E5, 0xFF979797, 0xFFB4B4B4, 0xFFB5B5B5, 0xFFB6B6B6, 0xFFB6B6B6, 0xFF9A9A9A, 0xFFE9E9E9, 0xFFE6E4E4, 0xFFB18585,
|
||||
0xFF7A1B1B, 0xFFA62F2F, 0xFFD35050, 0xFFF26767, 0xFFFF7070, 0xFFFE6E6E, 0xFFFC6969, 0xFFED5B5B, 0xFFCD4343, 0xFFA22525, 0xFF7E1D1D, 0xFF582C2C, 0x06020000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF6D6D6D, 0xFFFBFBFB, 0xFFE5E5E5, 0xFF7D7D7D, 0xFF959595, 0xFF969696, 0xFF979797, 0xFF979797, 0xFF808080, 0xFFB7ABAB, 0xFF7B2828, 0xFFAC3434,
|
||||
0xFFF56A6A, 0xFFFF7070, 0xFFFF7070, 0xFFFE6F6F, 0xFFFC6A6A, 0xFFFA6565, 0xFFF86060, 0xFFF55C5C, 0xFFF35757, 0xFFF15252, 0xFFE64848, 0xFFA11F1F, 0xCB530000, 0x1D0C0000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF6A6A6A, 0xFFFAFAFA, 0xFFE6E6E6, 0xFF989898, 0xFFB5B5B5, 0xFFB6B6B6, 0xFFB6B6B6, 0xFFB7B7B7, 0xFF989292, 0xFF7E2626, 0xFFCB5050, 0xFFFF7474,
|
||||
0xFFFF7070, 0xFFFF7070, 0xFFFD6B6B, 0xFFFA6767, 0xFFF86262, 0xFFF65D5D, 0xFFF45858, 0xFFF15353, 0xFFEF4E4E, 0xFFED4949, 0xFFEB4444, 0xFFE93F3F, 0xFFB62424, 0xD7570000, 0x0F060000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF666666, 0xFFFAFAFA, 0xFFE6E6E6, 0xFF7E7E7E, 0xFF969696, 0xFF979797, 0xFF979797, 0xFF989898, 0xFF733D3D, 0xFFA63737, 0xFFFF7979, 0xFFFF7272,
|
||||
0xFFFD6D6D, 0xFFFB6868, 0xFFF96363, 0xFFF65E5E, 0xFFF45959, 0xFFF25454, 0xFFF04F4F, 0xFFEE4A4A, 0xFFEB4545, 0xFFE94141, 0xFFE73C3C, 0xFFE53737, 0xFFE23535, 0xFF911313, 0x86360000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF636363, 0xFFFAFAFA, 0xFFE6E6E6, 0xFF989898, 0xFFB5B5B5, 0xFFB6B6B6, 0xFFB7B7B7, 0xFFB8B8B8, 0xFF6E1515, 0xFFDF6D6D, 0xFFFE7575, 0xFFFB6969,
|
||||
0xFFF96464, 0xFFF75F5F, 0xFFF55A5A, 0xFFF35555, 0xFFF05050, 0xFFEE4C4C, 0xFFEC4747, 0xFFEA4242, 0xFFE73D3D, 0xFFE53838, 0xFFE33333, 0xFFE12E2E, 0xFFDF2D2D, 0xFFC22828, 0xDE590000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF606060, 0xFFF9F9F9, 0xFFE6E6E6, 0xFF7E7E7E, 0xFF979797, 0xFF979797, 0xFF989898, 0xFF989898, 0xFF670101, 0xFFED7B7B, 0xFFFA6A6A, 0xFFF86060,
|
||||
0xFFF55B5B, 0xFFF35656, 0xFFF15252, 0xFFEF4D4D, 0xFFEC4848, 0xFFCD8478, 0xFF777CAE, 0xFF777BAD, 0xFF7275A7, 0xFF6B6FA1, 0xFF67699B, 0xFF606396, 0xFF5E6091, 0xFF7E5E82, 0xFC660000, 0x02000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF5D5D5D, 0xFFF9F9F9, 0xFFE6E6E6, 0xFF999999, 0xFFB6B6B6, 0xFFB6B6B6, 0xFFB7B7B7, 0xFFB8B8B8, 0xFF670000, 0xFFD86262, 0xFFF76D6D, 0xFFF45858,
|
||||
0xFFF15353, 0xFFEF4E4E, 0xFFED4949, 0xFFEB4444, 0xFFE84341, 0xFFC5E18C, 0xFF8A939F, 0xFF5889C7, 0xFF5182C1, 0xFF4B7CBA, 0xFF4475B4, 0xFF3D6EAE, 0xFF4572AD, 0xFF6A6087, 0xFF670000, 0x0E000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF595959, 0xFFF9F9F9, 0xFFE7E7E7, 0xFF7E7E7E, 0xFF979797, 0xFF979797, 0xFF989898, 0xFF989898, 0xFF690D0D, 0xFFA32424, 0xFFEF7B7B, 0xFFF15A5A,
|
||||
0xFFEE4A4A, 0xFFEB4545, 0xFFE94040, 0xFFE73C3C, 0xFFD86B4D, 0xFFADE773, 0xFFABC35F, 0xFF5585C0, 0xFF4D7EBD, 0xFF4778B7, 0xFF4071B0, 0xFF4372AE, 0xFF6B7AA6, 0xFF544267, 0xE85C0000, 0x16000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF565656, 0xFFF8F8F8, 0xFFE7E7E7, 0xFF999999, 0xFFB6B6B6, 0xFFB6B6B6, 0xFFB7B7B7, 0xFFB8B8B8, 0xFF773939, 0xFF7A0909, 0xFFBB3232, 0xFFE87171,
|
||||
0xFFED6161, 0xFFE84242, 0xFFE53838, 0xFFE33333, 0xFFBA9F4E, 0xFF99E053, 0xFF8FDC43, 0xFF848A66, 0xFF497AB9, 0xFF4777B4, 0xFF5882B9, 0xFF797FA6, 0xFF455E90, 0xFF651723, 0xAC3E0000, 0x13000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF535353, 0xFFF8F8F8, 0xFFE6E6E6, 0xFF7E7E7E, 0xFF979797, 0xFF979797, 0xFF989898, 0xFF989898, 0xFF766B6B, 0xFF6D0E0E, 0xFF881111, 0xFFB02323,
|
||||
0xFFCA4545, 0xFFE26666, 0xFFE85D5D, 0xFFE24F4B, 0xFFA1D656, 0xFF91DC47, 0xFF8BD93C, 0xFF90C93A, 0xFF7494BB, 0xFF848EB4, 0xFF70688E, 0xFF3B5E92, 0xFF602942, 0xEF5F0000, 0x400B0000, 0x08000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF4F4F4F, 0xFFF8F8F8, 0xFFE6E6E6, 0xFFE5E5E5, 0xFFE6E6E6, 0xFFE7E7E7, 0xFFE8E8E8, 0xFFE9E9E9, 0xFFE6E6E6, 0xFFBDA9A9, 0xFF711515, 0xFF7B0C0C,
|
||||
0xFFA21D1D, 0xFFAD1B1B, 0xFFB62727, 0xFFB24F33, 0xFF93A640, 0xFF96A840, 0xFF91A73C, 0xFF869F33, 0xFF6E675B, 0xFF375C93, 0xFF544D75, 0xFF6B1823, 0xEB5C0000, 0x59130000, 0x16000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x0D000000, 0xF14C4C4C, 0xFFF7F7F7, 0xFFF6F6F6, 0xFFF6F6F6, 0xFFF6F6F6, 0xFFF7F7F7, 0xFFF7F7F7, 0xFFF7F7F7, 0xFFF7F7F7, 0xFFF0F0F0, 0xFFD1C9C9, 0xFF905353,
|
||||
0xFF6A0505, 0xFF770A0A, 0xFF8E1414, 0xFF91331C, 0xFF728723, 0xFF709024, 0xFF6E8F23, 0xFF737C1F, 0xFF703C31, 0xFF6C141B, 0xFF6A0505, 0xFB531616, 0x52080000, 0x1D000000, 0x01000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x0D000000, 0x22000000, 0x78191919, 0xF6535353, 0xFF565656, 0xFF565656, 0xFF565656, 0xFF565656, 0xFF565656, 0xFF565656, 0xFF565656, 0xFF565656, 0xFF555555, 0xFF4F4F4F,
|
||||
0xFF4B4343, 0xFF522828, 0xFF5A1616, 0xFF610A0A, 0xFF650404, 0xFF670000, 0xFF650404, 0xFF600909, 0xFF591515, 0xFF502626, 0xF9453C3C, 0x93151515, 0x3A000000, 0x1B000000, 0x02000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x06000000, 0x1D000000, 0x30000000, 0x40000000, 0x47000000, 0x4A000000, 0x4A000000, 0x4A000000, 0x4A000000, 0x4A000000, 0x4A000000, 0x4A000000, 0x4A000000, 0x4A000000,
|
||||
0x4C000000, 0x54000000, 0x5E000000, 0x65000000, 0x69000000, 0x6B000000, 0x6B000000, 0x69000000, 0x63000000, 0x52000000, 0x4B000000, 0x3B000000, 0x29000000, 0x0C000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x07000000, 0x0F000000, 0x15000000, 0x16000000, 0x16000000, 0x16000000, 0x16000000, 0x16000000, 0x16000000, 0x16000000, 0x16000000, 0x16000000,
|
||||
0x16000000, 0x16000000, 0x16000000, 0x16000000, 0x17000000, 0x18000000, 0x17000000, 0x17000000, 0x16000000, 0x14000000, 0x0F000000, 0x08000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
void *data;
|
||||
int width;
|
||||
int height;
|
||||
int stride;
|
||||
} files[] = {
|
||||
{ "andlabs_16x16test_24june2016.png", dat0, 16, 16, 64 },
|
||||
{ "andlabs_32x32test_24june2016.png", dat1, 32, 32, 128 },
|
||||
{ "tango-icon-theme-0.8.90_16x16_x-office-spreadsheet.png", dat2, 16, 16, 64 },
|
||||
{ "tango-icon-theme-0.8.90_32x32_x-office-spreadsheet.png", dat3, 32, 32, 128 },
|
||||
};
|
||||
|
||||
void appendImageNamed(uiImage *img, const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
for (;;) {
|
||||
if (strcmp(name, files[i].name) == 0) {
|
||||
uiImageAppend(img, files[i].data, files[i].width, files[i].height, files[i].stride);
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
@ -159,8 +159,8 @@ int main(int argc, char *argv[])
|
|||
innerTab = newTab();
|
||||
uiTabAppend(outerTab, "Pages 16-?", uiControl(innerTab));
|
||||
|
||||
page16 = makePage16();
|
||||
uiTabAppend(innerTab, "Page 16", uiControl(page16));
|
||||
// page16 = makePage16();
|
||||
// uiTabAppend(innerTab, "Page 16", uiControl(page16));
|
||||
|
||||
if (startspaced)
|
||||
setSpaced(1);
|
||||
|
|
143
test/page16.c
143
test/page16.c
|
@ -1,143 +0,0 @@
|
|||
// 21 june 2016
|
||||
#include "test.h"
|
||||
|
||||
static uiTableModelHandler mh;
|
||||
|
||||
static int modelNumColumns(uiTableModelHandler *mh, uiTableModel *m)
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
|
||||
static uiTableModelColumnType modelColumnType(uiTableModelHandler *mh, uiTableModel *m, int column)
|
||||
{
|
||||
if (column == 3 || column == 4)
|
||||
return uiTableModelColumnColor;
|
||||
if (column == 5)
|
||||
return uiTableModelColumnImage;
|
||||
if (column == 7 || column == 8)
|
||||
return uiTableModelColumnInt;
|
||||
return uiTableModelColumnString;
|
||||
}
|
||||
|
||||
static int modelNumRows(uiTableModelHandler *mh, uiTableModel *m)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
static uiImage *img[2];
|
||||
static char row9text[1024];
|
||||
static int yellowRow = -1;
|
||||
static int checkStates[15];
|
||||
|
||||
static void *modelCellValue(uiTableModelHandler *mh, uiTableModel *m, int row, int col)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
if (col == 3) {
|
||||
if (row == yellowRow)
|
||||
return uiTableModelGiveColor(1, 1, 0, 1);
|
||||
if (row == 3)
|
||||
return uiTableModelGiveColor(1, 0, 0, 1);
|
||||
if (row == 11)
|
||||
return uiTableModelGiveColor(0, 0.5, 1, 0.5);
|
||||
return NULL;
|
||||
}
|
||||
if (col == 4) {
|
||||
if ((row % 2) == 1)
|
||||
return uiTableModelGiveColor(0.5, 0, 0.75, 1);
|
||||
return NULL;
|
||||
}
|
||||
if (col == 5) {
|
||||
if (row < 8)
|
||||
return img[0];
|
||||
return img[1];
|
||||
}
|
||||
if (col == 7)
|
||||
return uiTableModelGiveInt(checkStates[row]);
|
||||
if (col == 8) {
|
||||
if (row == 0)
|
||||
return uiTableModelGiveInt(0);
|
||||
if (row == 13)
|
||||
return uiTableModelGiveInt(100);
|
||||
if (row == 14)
|
||||
return uiTableModelGiveInt(-1);
|
||||
return uiTableModelGiveInt(50);
|
||||
}
|
||||
switch (col) {
|
||||
case 0:
|
||||
sprintf(buf, "Row %d", row);
|
||||
break;
|
||||
case 2:
|
||||
if (row == 9)
|
||||
return uiTableModelStrdup(row9text);
|
||||
// fall through
|
||||
case 1:
|
||||
strcpy(buf, "Part");
|
||||
break;
|
||||
case 6:
|
||||
strcpy(buf, "Make Yellow");
|
||||
break;
|
||||
}
|
||||
return uiTableModelStrdup(buf);
|
||||
}
|
||||
|
||||
static void modelSetCellValue(uiTableModelHandler *mh, uiTableModel *m, int row, int col, const void *val)
|
||||
{
|
||||
if (row == 9 && col == 2)
|
||||
strcpy(row9text, (const char *) val);
|
||||
if (col == 6)
|
||||
yellowRow = row;
|
||||
if (col == 7)
|
||||
checkStates[row] = uiTableModelTakeInt(val);
|
||||
}
|
||||
|
||||
uiBox *makePage16(void)
|
||||
{
|
||||
uiBox *page16;
|
||||
uiTableModel *m;
|
||||
uiTable *t;
|
||||
uiTableColumn *tc;
|
||||
|
||||
img[0] = uiNewImage(16, 16);
|
||||
appendImageNamed(img[0], "andlabs_16x16test_24june2016.png");
|
||||
appendImageNamed(img[0], "andlabs_32x32test_24june2016.png");
|
||||
img[1] = uiNewImage(16, 16);
|
||||
appendImageNamed(img[1], "tango-icon-theme-0.8.90_16x16_x-office-spreadsheet.png");
|
||||
appendImageNamed(img[1], "tango-icon-theme-0.8.90_32x32_x-office-spreadsheet.png");
|
||||
|
||||
strcpy(row9text, "Part");
|
||||
|
||||
memset(checkStates, 0, 15 * sizeof (int));
|
||||
|
||||
page16 = newVerticalBox();
|
||||
|
||||
mh.NumColumns = modelNumColumns;
|
||||
mh.ColumnType = modelColumnType;
|
||||
mh.NumRows = modelNumRows;
|
||||
mh.CellValue = modelCellValue;
|
||||
mh.SetCellValue = modelSetCellValue;
|
||||
m = uiNewTableModel(&mh);
|
||||
|
||||
t = uiNewTable(m);
|
||||
uiBoxAppend(page16, uiControl(t), 1);
|
||||
|
||||
uiTableAppendTextColumn(t, "Column 1", 0);
|
||||
|
||||
tc = uiTableAppendColumn(t, "Column 2");
|
||||
uiTableColumnAppendImagePart(tc, 5, 0);
|
||||
uiTableColumnAppendTextPart(tc, 1, 0);
|
||||
uiTableColumnAppendTextPart(tc, 2, 1);
|
||||
uiTableColumnPartSetTextColor(tc, 1, 4);
|
||||
uiTableColumnPartSetEditable(tc, 2, 1);
|
||||
|
||||
uiTableSetRowBackgroundColorModelColumn(t, 3);
|
||||
|
||||
tc = uiTableAppendColumn(t, "Buttons");
|
||||
uiTableColumnAppendCheckboxPart(tc, 7, 0);
|
||||
uiTableColumnAppendButtonPart(tc, 6, 1);
|
||||
|
||||
tc = uiTableAppendColumn(t, "Progress Bar");
|
||||
uiTableColumnAppendProgressBarPart(tc, 8, 0);
|
||||
|
||||
return page16;
|
||||
}
|
|
@ -89,9 +89,3 @@ extern uiTab *makePage14(void);
|
|||
|
||||
// page15.c
|
||||
extern uiBox *makePage15(uiWindow *);
|
||||
|
||||
// page16.c
|
||||
extern uiBox *makePage16(void);
|
||||
|
||||
// images.c
|
||||
extern void appendImageNamed(uiImage *img, const char *name);
|
||||
|
|
3
ui.h
3
ui.h
|
@ -684,9 +684,6 @@ _UI_EXTERN int uiGridPadded(uiGrid *g);
|
|||
_UI_EXTERN void uiGridSetPadded(uiGrid *g, int padded);
|
||||
_UI_EXTERN uiGrid *uiNewGrid(void);
|
||||
|
||||
// TODO merge
|
||||
#include "uitable.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
65
uitable.h
65
uitable.h
|
@ -1,65 +0,0 @@
|
|||
// 20 june 2016
|
||||
// kept in a separate file for now
|
||||
|
||||
typedef struct uiImage uiImage;
|
||||
|
||||
// TODO use const void * for const correctness
|
||||
_UI_EXTERN uiImage *uiNewImage(double width, double height);
|
||||
_UI_EXTERN void uiFreeImage(uiImage *i);
|
||||
_UI_EXTERN void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, int pixelStride);
|
||||
|
||||
typedef struct uiTableModel uiTableModel;
|
||||
typedef struct uiTableModelHandler uiTableModelHandler;
|
||||
|
||||
// TODO actually validate these
|
||||
_UI_ENUM(uiTableModelColumnType) {
|
||||
uiTableModelColumnString,
|
||||
uiTableModelColumnImage,
|
||||
uiTableModelColumnInt,
|
||||
uiTableModelColumnColor,
|
||||
};
|
||||
|
||||
// TODO validate ranges; validate types on each getter/setter call (? table columns only?)
|
||||
struct uiTableModelHandler {
|
||||
int (*NumColumns)(uiTableModelHandler *, uiTableModel *);
|
||||
uiTableModelColumnType (*ColumnType)(uiTableModelHandler *, uiTableModel *, int);
|
||||
int (*NumRows)(uiTableModelHandler *, uiTableModel *);
|
||||
void *(*CellValue)(uiTableModelHandler *, uiTableModel *, int, int);
|
||||
void (*SetCellValue)(uiTableModelHandler *, uiTableModel *, int, int, const void *);
|
||||
};
|
||||
|
||||
_UI_EXTERN void *uiTableModelStrdup(const char *str);
|
||||
// TODO rename the strdup one to this too
|
||||
_UI_EXTERN void *uiTableModelGiveColor(double r, double g, double b, double a);
|
||||
_UI_EXTERN void *uiTableModelGiveInt(int i);
|
||||
// TODO TakeString
|
||||
// TODO add const
|
||||
_UI_EXTERN int uiTableModelTakeInt(void *v);
|
||||
|
||||
_UI_EXTERN uiTableModel *uiNewTableModel(uiTableModelHandler *mh);
|
||||
_UI_EXTERN void uiFreeTableModel(uiTableModel *m);
|
||||
_UI_EXTERN void uiTableModelRowInserted(uiTableModel *m, int newIndex);
|
||||
_UI_EXTERN void uiTableModelRowChanged(uiTableModel *m, int index);
|
||||
_UI_EXTERN void uiTableModelRowDeleted(uiTableModel *m, int oldIndex);
|
||||
// TODO reordering/moving
|
||||
|
||||
typedef struct uiTableColumn uiTableColumn;
|
||||
|
||||
_UI_EXTERN void uiTableColumnAppendTextPart(uiTableColumn *c, int modelColumn, int expand);
|
||||
// TODO images shouldn't expand...
|
||||
_UI_EXTERN void uiTableColumnAppendImagePart(uiTableColumn *c, int modelColumn, int expand);
|
||||
_UI_EXTERN void uiTableColumnAppendButtonPart(uiTableColumn *c, int modelColumn, int expand);
|
||||
// TODO should these have labels?
|
||||
_UI_EXTERN void uiTableColumnAppendCheckboxPart(uiTableColumn *c, int modelColumn, int expand);
|
||||
_UI_EXTERN void uiTableColumnAppendProgressBarPart(uiTableColumn *c, int modelColumn, int expand);
|
||||
// TODO Editable?
|
||||
_UI_EXTERN void uiTableColumnPartSetEditable(uiTableColumn *c, int part, int editable);
|
||||
_UI_EXTERN void uiTableColumnPartSetTextColor(uiTableColumn *c, int part, int modelColumn);
|
||||
|
||||
typedef struct uiTable uiTable;
|
||||
#define uiTable(this) ((uiTable *) (this))
|
||||
_UI_EXTERN uiTableColumn *uiTableAppendColumn(uiTable *t, const char *name);
|
||||
_UI_EXTERN uiTableColumn *uiTableAppendTextColumn(uiTable *t, const char *name, int modelColumn);
|
||||
// TODO getter?
|
||||
_UI_EXTERN void uiTableSetRowBackgroundColorModelColumn(uiTable *t, int modelColumn);
|
||||
_UI_EXTERN uiTable *uiNewTable(uiTableModel *model);
|
|
@ -40,7 +40,6 @@ list(APPEND _LIBUI_SOURCES
|
|||
unix/spinbox.c
|
||||
unix/stddialogs.c
|
||||
unix/tab.c
|
||||
unix/table.c
|
||||
unix/text.c
|
||||
unix/util.c
|
||||
unix/window.c
|
||||
|
|
642
unix/table.c
642
unix/table.c
|
@ -1,642 +0,0 @@
|
|||
// 26 june 2016
|
||||
#include "uipriv_unix.h"
|
||||
|
||||
#define uiTableModelType (uiTableModel_get_type())
|
||||
#define uiTableModel(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), uiTableModelType, uiTableModel))
|
||||
#define isuiTableModel(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), uiTableModelType))
|
||||
#define uiTableModelClass(class) (G_TYPE_CHECK_CLASS_CAST((class), uiTableModelType, uiTableModelClass))
|
||||
#define isuiTableModelClass(class) (G_TYPE_CHECK_CLASS_TYPE((class), uiTableModel))
|
||||
#define getuiTableModelClass(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), uiTableModelType, uiTableModelClass))
|
||||
|
||||
typedef struct uiTableModelClass uiTableModelClass;
|
||||
|
||||
struct uiTableModel {
|
||||
GObject parent_instance;
|
||||
uiTableModelHandler *mh;
|
||||
};
|
||||
|
||||
struct uiTableModelClass {
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
static void uiTableModel_gtk_tree_model_interface_init(GtkTreeModelIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(uiTableModel, uiTableModel, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE(GTK_TYPE_TREE_MODEL, uiTableModel_gtk_tree_model_interface_init))
|
||||
|
||||
static void uiTableModel_init(uiTableModel *m)
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
static void uiTableModel_dispose(GObject *obj)
|
||||
{
|
||||
G_OBJECT_CLASS(uiTableModel_parent_class)->dispose(obj);
|
||||
}
|
||||
|
||||
static void uiTableModel_finalize(GObject *obj)
|
||||
{
|
||||
G_OBJECT_CLASS(uiTableModel_parent_class)->finalize(obj);
|
||||
}
|
||||
|
||||
static GtkTreeModelFlags uiTableModel_get_flags(GtkTreeModel *mm)
|
||||
{
|
||||
return GTK_TREE_MODEL_LIST_ONLY;
|
||||
}
|
||||
|
||||
static gint uiTableModel_get_n_columns(GtkTreeModel *mm)
|
||||
{
|
||||
uiTableModel *m = uiTableModel(mm);
|
||||
|
||||
return (*(m->mh->NumColumns))(m->mh, m);
|
||||
}
|
||||
|
||||
static GType uiTableModel_get_column_type(GtkTreeModel *mm, gint index)
|
||||
{
|
||||
uiTableModel *m = uiTableModel(mm);
|
||||
|
||||
switch ((*(m->mh->ColumnType))(m->mh, m, index)) {
|
||||
case uiTableModelColumnString:
|
||||
return G_TYPE_STRING;
|
||||
case uiTableModelColumnImage:
|
||||
return G_TYPE_POINTER;
|
||||
case uiTableModelColumnInt:
|
||||
return G_TYPE_INT;
|
||||
case uiTableModelColumnColor:
|
||||
return GDK_TYPE_RGBA;
|
||||
}
|
||||
// TODO
|
||||
return G_TYPE_INVALID;
|
||||
}
|
||||
|
||||
#define STAMP_GOOD 0x1234
|
||||
#define STAMP_BAD 0x5678
|
||||
|
||||
static gboolean uiTableModel_get_iter(GtkTreeModel *mm, GtkTreeIter *iter, GtkTreePath *path)
|
||||
{
|
||||
uiTableModel *m = uiTableModel(mm);
|
||||
gint row;
|
||||
|
||||
if (gtk_tree_path_get_depth(path) != 1)
|
||||
goto bad;
|
||||
row = gtk_tree_path_get_indices(path)[0];
|
||||
if (row < 0)
|
||||
goto bad;
|
||||
if (row >= (*(m->mh->NumRows))(m->mh, m))
|
||||
goto bad;
|
||||
iter->stamp = STAMP_GOOD;
|
||||
iter->user_data = GINT_TO_POINTER(row);
|
||||
return TRUE;
|
||||
bad:
|
||||
iter->stamp = STAMP_BAD;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// GtkListStore returns NULL on error; let's do that too
|
||||
static GtkTreePath *uiTableModel_get_path(GtkTreeModel *mm, GtkTreeIter *iter)
|
||||
{
|
||||
gint row;
|
||||
|
||||
if (iter->stamp != STAMP_GOOD)
|
||||
return NULL;
|
||||
row = GPOINTER_TO_INT(iter->user_data);
|
||||
return gtk_tree_path_new_from_indices(row, -1);
|
||||
}
|
||||
|
||||
// GtkListStore leaves value empty on failure; let's do the same
|
||||
static void uiTableModel_get_value(GtkTreeModel *mm, GtkTreeIter *iter, gint column, GValue *value)
|
||||
{
|
||||
uiTableModel *m = uiTableModel(mm);
|
||||
gint row;
|
||||
void *data;
|
||||
|
||||
if (iter->stamp != STAMP_GOOD)
|
||||
return;
|
||||
row = GPOINTER_TO_INT(iter->user_data);
|
||||
data = (*(m->mh->CellValue))(m->mh, m, row, column);
|
||||
switch ((*(m->mh->ColumnType))(m->mh, m, column)) {
|
||||
case uiTableModelColumnString:
|
||||
g_value_init(value, G_TYPE_STRING);
|
||||
g_value_take_string(value, (char *) data);
|
||||
return;
|
||||
case uiTableModelColumnImage:
|
||||
g_value_init(value, G_TYPE_POINTER);
|
||||
g_value_set_pointer(value, data);
|
||||
return;
|
||||
case uiTableModelColumnInt:
|
||||
g_value_init(value, G_TYPE_INT);
|
||||
g_value_set_int(value, uiTableModelTakeInt(data));
|
||||
return;
|
||||
case uiTableModelColumnColor:
|
||||
g_value_init(value, GDK_TYPE_RGBA);
|
||||
g_value_take_boxed(value, data);
|
||||
return;
|
||||
}
|
||||
// TODO
|
||||
}
|
||||
|
||||
static gboolean uiTableModel_iter_next(GtkTreeModel *mm, GtkTreeIter *iter)
|
||||
{
|
||||
uiTableModel *m = uiTableModel(mm);
|
||||
gint row;
|
||||
|
||||
if (iter->stamp != STAMP_GOOD)
|
||||
return FALSE;
|
||||
row = GPOINTER_TO_INT(iter->user_data);
|
||||
row++;
|
||||
if (row >= (*(m->mh->NumRows))(m->mh, m)) {
|
||||
iter->stamp = STAMP_BAD;
|
||||
return FALSE;
|
||||
}
|
||||
iter->user_data = GINT_TO_POINTER(row);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean uiTableModel_iter_previous(GtkTreeModel *mm, GtkTreeIter *iter)
|
||||
{
|
||||
gint row;
|
||||
|
||||
if (iter->stamp != STAMP_GOOD)
|
||||
return FALSE;
|
||||
row = GPOINTER_TO_INT(iter->user_data);
|
||||
row--;
|
||||
if (row < 0) {
|
||||
iter->stamp = STAMP_BAD;
|
||||
return FALSE;
|
||||
}
|
||||
iter->user_data = GINT_TO_POINTER(row);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean uiTableModel_iter_children(GtkTreeModel *mm, GtkTreeIter *iter, GtkTreeIter *parent)
|
||||
{
|
||||
return gtk_tree_model_iter_nth_child(mm, iter, parent, 0);
|
||||
}
|
||||
|
||||
static gboolean uiTableModel_iter_has_child(GtkTreeModel *mm, GtkTreeIter *iter)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint uiTableModel_iter_n_children(GtkTreeModel *mm, GtkTreeIter *iter)
|
||||
{
|
||||
uiTableModel *m = uiTableModel(mm);
|
||||
|
||||
if (iter != NULL)
|
||||
return 0;
|
||||
return (*(m->mh->NumRows))(m->mh, m);
|
||||
}
|
||||
|
||||
static gboolean uiTableModel_iter_nth_child(GtkTreeModel *mm, GtkTreeIter *iter, GtkTreeIter *parent, gint n)
|
||||
{
|
||||
uiTableModel *m = uiTableModel(mm);
|
||||
|
||||
if (iter->stamp != STAMP_GOOD)
|
||||
return FALSE;
|
||||
if (parent != NULL)
|
||||
goto bad;
|
||||
if (n < 0)
|
||||
goto bad;
|
||||
if (n >= (*(m->mh->NumRows))(m->mh, m))
|
||||
goto bad;
|
||||
iter->stamp = STAMP_GOOD;
|
||||
iter->user_data = GINT_TO_POINTER(n);
|
||||
return TRUE;
|
||||
bad:
|
||||
iter->stamp = STAMP_BAD;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean uiTableModel_iter_parent(GtkTreeModel *mm, GtkTreeIter *iter, GtkTreeIter *child)
|
||||
{
|
||||
iter->stamp = STAMP_BAD;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void uiTableModel_class_init(uiTableModelClass *class)
|
||||
{
|
||||
G_OBJECT_CLASS(class)->dispose = uiTableModel_dispose;
|
||||
G_OBJECT_CLASS(class)->finalize = uiTableModel_finalize;
|
||||
}
|
||||
|
||||
static void uiTableModel_gtk_tree_model_interface_init(GtkTreeModelIface *iface)
|
||||
{
|
||||
iface->get_flags = uiTableModel_get_flags;
|
||||
iface->get_n_columns = uiTableModel_get_n_columns;
|
||||
iface->get_column_type = uiTableModel_get_column_type;
|
||||
iface->get_iter = uiTableModel_get_iter;
|
||||
iface->get_path = uiTableModel_get_path;
|
||||
iface->get_value = uiTableModel_get_value;
|
||||
iface->iter_next = uiTableModel_iter_next;
|
||||
iface->iter_previous = uiTableModel_iter_previous;
|
||||
iface->iter_children = uiTableModel_iter_children;
|
||||
iface->iter_has_child = uiTableModel_iter_has_child;
|
||||
iface->iter_n_children = uiTableModel_iter_n_children;
|
||||
iface->iter_nth_child = uiTableModel_iter_nth_child;
|
||||
iface->iter_parent = uiTableModel_iter_parent;
|
||||
// don't specify ref_node() or unref_node()
|
||||
}
|
||||
|
||||
void *uiTableModelStrdup(const char *str)
|
||||
{
|
||||
return g_strdup(str);
|
||||
}
|
||||
|
||||
void *uiTableModelGiveColor(double r, double g, double b, double a)
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
|
||||
rgba.red = r;
|
||||
rgba.green = g;
|
||||
rgba.blue = b;
|
||||
rgba.alpha = a;
|
||||
return gdk_rgba_copy(&rgba);
|
||||
}
|
||||
|
||||
uiTableModel *uiNewTableModel(uiTableModelHandler *mh)
|
||||
{
|
||||
uiTableModel *m;
|
||||
|
||||
m = uiTableModel(g_object_new(uiTableModelType, NULL));
|
||||
m->mh = mh;
|
||||
return m;
|
||||
}
|
||||
|
||||
void uiFreeTableModel(uiTableModel *m)
|
||||
{
|
||||
g_object_unref(m);
|
||||
}
|
||||
|
||||
void uiTableModelRowInserted(uiTableModel *m, int newIndex)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
|
||||
path = gtk_tree_path_new_from_indices(newIndex, -1);
|
||||
iter.stamp = STAMP_GOOD;
|
||||
iter.user_data = GINT_TO_POINTER(newIndex);
|
||||
gtk_tree_model_row_inserted(GTK_TREE_MODEL(m), path, &iter);
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
|
||||
void uiTableModelRowChanged(uiTableModel *m, int index)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
|
||||
path = gtk_tree_path_new_from_indices(index, -1);
|
||||
iter.stamp = STAMP_GOOD;
|
||||
iter.user_data = GINT_TO_POINTER(index);
|
||||
gtk_tree_model_row_changed(GTK_TREE_MODEL(m), path, &iter);
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
|
||||
void uiTableModelRowDeleted(uiTableModel *m, int oldIndex)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
||||
path = gtk_tree_path_new_from_indices(oldIndex, -1);
|
||||
gtk_tree_model_row_deleted(GTK_TREE_MODEL(m), path);
|
||||
gtk_tree_path_free(path);
|
||||
}
|
||||
|
||||
enum {
|
||||
partText,
|
||||
partImage,
|
||||
partButton,
|
||||
partCheckbox,
|
||||
partProgressBar,
|
||||
};
|
||||
|
||||
struct tablePart {
|
||||
int type;
|
||||
int textColumn;
|
||||
int imageColumn;
|
||||
int valueColumn;
|
||||
int colorColumn;
|
||||
GtkCellRenderer *r;
|
||||
uiTable *tv; // for pixbufs and background color
|
||||
};
|
||||
|
||||
struct uiTableColumn {
|
||||
GtkTreeViewColumn *c;
|
||||
uiTable *tv; // for pixbufs and background color
|
||||
GPtrArray *parts;
|
||||
};
|
||||
|
||||
struct uiTable {
|
||||
uiUnixControl c;
|
||||
GtkWidget *widget;
|
||||
GtkContainer *scontainer;
|
||||
GtkScrolledWindow *sw;
|
||||
GtkWidget *treeWidget;
|
||||
GtkTreeView *tv;
|
||||
GPtrArray *columns;
|
||||
uiTableModel *model;
|
||||
int backgroundColumn;
|
||||
};
|
||||
|
||||
// use the same size as GtkFileChooserWidget's treeview
|
||||
// TODO refresh when icon theme changes
|
||||
// TODO doesn't work when scaled
|
||||
// TODO is this even necessary?
|
||||
static void setImageSize(GtkCellRenderer *r)
|
||||
{
|
||||
gint size;
|
||||
gint width, height;
|
||||
gint xpad, ypad;
|
||||
|
||||
size = 16; // fallback used by GtkFileChooserWidget
|
||||
if (gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height) != FALSE)
|
||||
size = MAX(width, height);
|
||||
gtk_cell_renderer_get_padding(r, &xpad, &ypad);
|
||||
gtk_cell_renderer_set_fixed_size(r,
|
||||
2 * xpad + size,
|
||||
2 * ypad + size);
|
||||
}
|
||||
|
||||
static void applyColor(GtkTreeModel *mm, GtkTreeIter *iter, int modelColumn, GtkCellRenderer *r, const char *prop, const char *propSet)
|
||||
{
|
||||
GValue value = G_VALUE_INIT;
|
||||
GdkRGBA *rgba;
|
||||
|
||||
gtk_tree_model_get_value(mm, iter, modelColumn, &value);
|
||||
rgba = (GdkRGBA *) g_value_get_boxed(&value);
|
||||
if (rgba != NULL)
|
||||
g_object_set(r, prop, rgba, NULL);
|
||||
else
|
||||
g_object_set(r, propSet, FALSE, NULL);
|
||||
g_value_unset(&value);
|
||||
}
|
||||
|
||||
static void dataFunc(GtkTreeViewColumn *c, GtkCellRenderer *r, GtkTreeModel *mm, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
struct tablePart *part = (struct tablePart *) data;
|
||||
GValue value = G_VALUE_INIT;
|
||||
const gchar *str;
|
||||
uiImage *img;
|
||||
int pval;
|
||||
|
||||
switch (part->type) {
|
||||
case partText:
|
||||
gtk_tree_model_get_value(mm, iter, part->textColumn, &value);
|
||||
str = g_value_get_string(&value);
|
||||
g_object_set(r, "text", str, NULL);
|
||||
if (part->colorColumn != -1)
|
||||
applyColor(mm, iter,
|
||||
part->colorColumn,
|
||||
r, "foreground-rgba", "foreground-set");
|
||||
break;
|
||||
case partImage:
|
||||
//TODO setImageSize(r);
|
||||
gtk_tree_model_get_value(mm, iter, part->imageColumn, &value);
|
||||
img = (uiImage *) g_value_get_pointer(&value);
|
||||
g_object_set(r, "surface",
|
||||
imageAppropriateSurface(img, part->tv->treeWidget),
|
||||
NULL);
|
||||
break;
|
||||
case partButton:
|
||||
gtk_tree_model_get_value(mm, iter, part->textColumn, &value);
|
||||
str = g_value_get_string(&value);
|
||||
g_object_set(r, "text", str, NULL);
|
||||
break;
|
||||
case partCheckbox:
|
||||
gtk_tree_model_get_value(mm, iter, part->valueColumn, &value);
|
||||
g_object_set(r, "active", g_value_get_int(&value) != 0, NULL);
|
||||
break;
|
||||
case partProgressBar:
|
||||
gtk_tree_model_get_value(mm, iter, part->valueColumn, &value);
|
||||
pval = g_value_get_int(&value);
|
||||
if (pval == -1) {
|
||||
// TODO
|
||||
} else
|
||||
g_object_set(r,
|
||||
"pulse", -1,
|
||||
"value", pval,
|
||||
NULL);
|
||||
break;
|
||||
}
|
||||
g_value_unset(&value);
|
||||
|
||||
if (part->tv->backgroundColumn != -1)
|
||||
applyColor(mm, iter,
|
||||
part->tv->backgroundColumn,
|
||||
r, "cell-background-rgba", "cell-background-set");
|
||||
}
|
||||
|
||||
static void onEdited(struct tablePart *part, int column, const char *pathstr, const void *data)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
int row;
|
||||
uiTableModel *m;
|
||||
|
||||
path = gtk_tree_path_new_from_string(pathstr);
|
||||
row = gtk_tree_path_get_indices(path)[0];
|
||||
gtk_tree_path_free(path);
|
||||
m = part->tv->model;
|
||||
(*(m->mh->SetCellValue))(m->mh, m, row, column, data);
|
||||
// and update
|
||||
uiTableModelRowChanged(m, row);
|
||||
}
|
||||
|
||||
static void appendPart(uiTableColumn *c, struct tablePart *part, GtkCellRenderer *r, int expand)
|
||||
{
|
||||
part->r = r;
|
||||
gtk_tree_view_column_pack_start(c->c, part->r, expand != 0);
|
||||
gtk_tree_view_column_set_cell_data_func(c->c, part->r, dataFunc, part, NULL);
|
||||
g_ptr_array_add(c->parts, part);
|
||||
}
|
||||
|
||||
static void textEdited(GtkCellRendererText *renderer, gchar *path, gchar *newText, gpointer data)
|
||||
{
|
||||
struct tablePart *part = (struct tablePart *) data;
|
||||
|
||||
onEdited(part, part->textColumn, path, newText);
|
||||
}
|
||||
|
||||
void uiTableColumnAppendTextPart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
struct tablePart *part;
|
||||
GtkCellRenderer *r;
|
||||
|
||||
part = uiNew(struct tablePart);
|
||||
part->type = partText;
|
||||
part->textColumn = modelColumn;
|
||||
part->tv = c->tv;
|
||||
part->colorColumn = -1;
|
||||
|
||||
r = gtk_cell_renderer_text_new();
|
||||
g_object_set(r, "editable", FALSE, NULL);
|
||||
g_signal_connect(r, "edited", G_CALLBACK(textEdited), part);
|
||||
|
||||
appendPart(c, part, r, expand);
|
||||
}
|
||||
|
||||
void uiTableColumnAppendImagePart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
struct tablePart *part;
|
||||
|
||||
part = uiNew(struct tablePart);
|
||||
part->type = partImage;
|
||||
part->imageColumn = modelColumn;
|
||||
part->tv = c->tv;
|
||||
appendPart(c, part,
|
||||
gtk_cell_renderer_pixbuf_new(),
|
||||
expand);
|
||||
}
|
||||
|
||||
// TODO wrong type here
|
||||
static void buttonClicked(GtkCellRenderer *r, gchar *pathstr, gpointer data)
|
||||
{
|
||||
struct tablePart *part = (struct tablePart *) data;
|
||||
|
||||
onEdited(part, part->textColumn, pathstr, NULL);
|
||||
}
|
||||
|
||||
void uiTableColumnAppendButtonPart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
struct tablePart *part;
|
||||
GtkCellRenderer *r;
|
||||
|
||||
part = uiNew(struct tablePart);
|
||||
part->type = partButton;
|
||||
part->textColumn = modelColumn;
|
||||
part->tv = c->tv;
|
||||
|
||||
r = newCellRendererButton();
|
||||
g_object_set(r, "sensitive", TRUE, NULL); // editable by default
|
||||
g_signal_connect(r, "clicked", G_CALLBACK(buttonClicked), part);
|
||||
|
||||
appendPart(c, part, r, expand);
|
||||
}
|
||||
|
||||
// yes, we need to do all this twice :|
|
||||
static void checkboxToggled(GtkCellRendererToggle *r, gchar *pathstr, gpointer data)
|
||||
{
|
||||
struct tablePart *part = (struct tablePart *) data;
|
||||
GtkTreePath *path;
|
||||
int row;
|
||||
uiTableModel *m;
|
||||
void *value;
|
||||
int intval;
|
||||
|
||||
path = gtk_tree_path_new_from_string(pathstr);
|
||||
row = gtk_tree_path_get_indices(path)[0];
|
||||
gtk_tree_path_free(path);
|
||||
m = part->tv->model;
|
||||
value = (*(m->mh->CellValue))(m->mh, m, row, part->valueColumn);
|
||||
intval = !uiTableModelTakeInt(value);
|
||||
onEdited(part, part->valueColumn, pathstr, uiTableModelGiveInt(intval));
|
||||
}
|
||||
|
||||
void uiTableColumnAppendCheckboxPart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
struct tablePart *part;
|
||||
GtkCellRenderer *r;
|
||||
|
||||
part = uiNew(struct tablePart);
|
||||
part->type = partCheckbox;
|
||||
part->valueColumn = modelColumn;
|
||||
part->tv = c->tv;
|
||||
|
||||
r = gtk_cell_renderer_toggle_new();
|
||||
g_object_set(r, "sensitive", TRUE, NULL); // editable by default
|
||||
g_signal_connect(r, "toggled", G_CALLBACK(checkboxToggled), part);
|
||||
|
||||
appendPart(c, part, r, expand);
|
||||
}
|
||||
|
||||
void uiTableColumnAppendProgressBarPart(uiTableColumn *c, int modelColumn, int expand)
|
||||
{
|
||||
struct tablePart *part;
|
||||
|
||||
part = uiNew(struct tablePart);
|
||||
part->type = partProgressBar;
|
||||
part->valueColumn = modelColumn;
|
||||
part->tv = c->tv;
|
||||
appendPart(c, part,
|
||||
gtk_cell_renderer_progress_new(),
|
||||
expand);
|
||||
}
|
||||
|
||||
void uiTableColumnPartSetEditable(uiTableColumn *c, int part, int editable)
|
||||
{
|
||||
struct tablePart *p;
|
||||
|
||||
p = (struct tablePart *) g_ptr_array_index(c->parts, part);
|
||||
switch (p->type) {
|
||||
case partImage:
|
||||
case partProgressBar:
|
||||
return;
|
||||
case partButton:
|
||||
case partCheckbox:
|
||||
g_object_set(p->r, "sensitive", editable != 0, NULL);
|
||||
return;
|
||||
}
|
||||
g_object_set(p->r, "editable", editable != 0, NULL);
|
||||
}
|
||||
|
||||
void uiTableColumnPartSetTextColor(uiTableColumn *c, int part, int modelColumn)
|
||||
{
|
||||
struct tablePart *p;
|
||||
|
||||
p = (struct tablePart *) g_ptr_array_index(c->parts, part);
|
||||
p->colorColumn = modelColumn;
|
||||
// TODO refresh table
|
||||
}
|
||||
|
||||
uiUnixControlAllDefaultsExceptDestroy(uiTable)
|
||||
|
||||
static void uiTableDestroy(uiControl *c)
|
||||
{
|
||||
uiTable *t = uiTable(c);
|
||||
|
||||
// TODO
|
||||
g_object_unref(t->widget);
|
||||
uiFreeControl(uiControl(t));
|
||||
}
|
||||
|
||||
uiTableColumn *uiTableAppendColumn(uiTable *t, const char *name)
|
||||
{
|
||||
uiTableColumn *c;
|
||||
|
||||
c = uiNew(uiTableColumn);
|
||||
c->c = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_set_resizable(c->c, TRUE);
|
||||
gtk_tree_view_column_set_title(c->c, name);
|
||||
gtk_tree_view_append_column(t->tv, c->c);
|
||||
c->tv = t; // TODO rename field to t, cascade
|
||||
c->parts = g_ptr_array_new();
|
||||
return c;
|
||||
}
|
||||
|
||||
void uiTableSetRowBackgroundColorModelColumn(uiTable *t, int modelColumn)
|
||||
{
|
||||
t->backgroundColumn = modelColumn;
|
||||
// TODO refresh table
|
||||
}
|
||||
|
||||
uiTable *uiNewTable(uiTableModel *model)
|
||||
{
|
||||
uiTable *t;
|
||||
|
||||
uiUnixNewControl(uiTable, t);
|
||||
|
||||
t->model = model;
|
||||
t->backgroundColumn = -1;
|
||||
|
||||
t->widget = gtk_scrolled_window_new(NULL, NULL);
|
||||
t->scontainer = GTK_CONTAINER(t->widget);
|
||||
t->sw = GTK_SCROLLED_WINDOW(t->widget);
|
||||
gtk_scrolled_window_set_shadow_type(t->sw, GTK_SHADOW_IN);
|
||||
|
||||
t->treeWidget = gtk_tree_view_new_with_model(GTK_TREE_MODEL(t->model));
|
||||
t->tv = GTK_TREE_VIEW(t->treeWidget);
|
||||
// TODO set up t->tv
|
||||
|
||||
gtk_container_add(t->scontainer, t->treeWidget);
|
||||
// and make the tree view visible; only the scrolled window's visibility is controlled by libui
|
||||
gtk_widget_show(t->treeWidget);
|
||||
|
||||
return t;
|
||||
}
|
|
@ -2,6 +2,8 @@
|
|||
#include "uipriv_windows.hpp"
|
||||
#include "area.hpp"
|
||||
|
||||
// TODO handle WM_DESTROY/WM_NCDESTROY
|
||||
// TODO same for other Direct2D stuff
|
||||
static LRESULT CALLBACK areaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
uiArea *a;
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
// 30 june 2016
|
||||
// TODO includes
|
||||
|
||||
typedef struct tablePartDrawParams tablePartDrawParams;
|
||||
typedef struct tablePartMinimumSizeParams tableDrawMinimumSizeParams;
|
||||
typedef struct tablePartEditingParams tablePartEditingParams;
|
||||
|
||||
struct tablePartDrawParams {
|
||||
HWND hwnd;
|
||||
HDC hdc;
|
||||
RECT *r;
|
||||
bool selected;
|
||||
bool focused;
|
||||
bool hovering;
|
||||
uiTableModel *model;
|
||||
int row;
|
||||
};
|
||||
|
||||
struct tablePartMinimumSizeParams {
|
||||
HWND hwnd;
|
||||
HDC hdc;
|
||||
uiTableModel *model;
|
||||
int row;
|
||||
};
|
||||
|
||||
enum {
|
||||
partEventDoNothing,
|
||||
partEventRedraw,
|
||||
partEventEdit,
|
||||
};
|
||||
|
||||
struct tablePartEditingParams {
|
||||
HWND newHWND;
|
||||
};
|
||||
|
||||
enum {
|
||||
partEditContinue,
|
||||
partEditDone,
|
||||
};
|
||||
|
||||
class tablePart {
|
||||
public:
|
||||
// needed so we can delete a tablePart
|
||||
virtual ~tablePart() {}
|
||||
|
||||
virtual HRESULT Draw(tablePartDrawParams *p) = 0;
|
||||
virtual HRESULT MinimumSize(tablePartMinimumSizeParams *p, int *width, int *height) = 0;
|
||||
|
||||
// returns a partEvent constant
|
||||
virtual int MouseMove(int x, int y, RECT *cell) = 0;
|
||||
virtual int MouseLeave(void) = 0;
|
||||
virtual int LButtonDown(int x, int y, int count, RECT *cell) = 0;
|
||||
virtual int LButtonUp(int x, int y, RECT *cell) = 0;
|
||||
virtual int CaptureBroken(void) = 0;
|
||||
virtual int KeyDown(void) = 0;
|
||||
virtual int KeyUp(void) = 0;
|
||||
|
||||
// editing; all optional
|
||||
virtual int StartEditing(tablePartEditingParams *p) { return editDone; }
|
||||
virtual int EditChildWM_COMMAND(WORD code, LRESULT *lr) { return editDone; }
|
||||
virtual void FinishEditing(uiTableModel *model, int row) {}
|
||||
virtual void CancelEditing(void) {}
|
||||
|
||||
// TODO tooltips
|
||||
// TODO timers and animations
|
||||
|
||||
// optional methods
|
||||
virtual void SetTextColorColumn(int col) {}
|
||||
virtual void SetEditable(bool editable) {}
|
||||
};
|
||||
|
||||
class tablePartText : public tablePart {
|
||||
int textColumn;
|
||||
int colorColumn;
|
||||
public:
|
||||
tablePartText(int tc)
|
||||
{
|
||||
this->textColumn = tc;
|
||||
this->colorColumn = -1;
|
||||
}
|
||||
|
||||
// TODO figure out vertical alignment
|
||||
virtual HRESULT Draw(tablePartDrawParams *p)
|
||||
{
|
||||
}
|
||||
|
||||
virtual HRESULT MinimumSize(tablePartMinimumSizeParams *p, int *width, int *height)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
tablePart *newTablePartText(int tc)
|
||||
{
|
||||
return new tablePartText(tc);
|
||||
}
|
Loading…
Reference in New Issue