| 117 UIWIDGET ui_table_create(UiObject* obj, UiListArgs *args) { |
117 UIWIDGET ui_table_create(UiObject* obj, UiListArgs *args) { |
| 118 NSScrollView *scrollview = [[NSScrollView alloc] init]; |
118 NSScrollView *scrollview = [[NSScrollView alloc] init]; |
| 119 |
119 |
| 120 NSTableView *tableview = [[NSTableView alloc] init]; |
120 NSTableView *tableview = [[NSTableView alloc] init]; |
| 121 tableview.autoresizingMask = NSViewWidthSizable; |
121 tableview.autoresizingMask = NSViewWidthSizable; |
| |
122 tableview.columnAutoresizingStyle = NSTableViewSequentialColumnAutoresizingStyle; |
| 122 |
123 |
| 123 if(args->multiselection) { |
124 if(args->multiselection) { |
| 124 tableview.allowsMultipleSelection = YES; |
125 tableview.allowsMultipleSelection = YES; |
| 125 } |
126 } |
| 126 |
127 |
| 138 UiModelType type = model->types[i]; |
139 UiModelType type = model->types[i]; |
| 139 int width = model->columnsize[i]; |
140 int width = model->columnsize[i]; |
| 140 NSString *identifier = [[NSString alloc] initWithUTF8String:title]; |
141 NSString *identifier = [[NSString alloc] initWithUTF8String:title]; |
| 141 NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:identifier]; |
142 NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:identifier]; |
| 142 column.title = identifier; |
143 column.title = identifier; |
| |
144 column.resizingMask = NSTableColumnUserResizingMask; |
| 143 if(width > 0) { |
145 if(width > 0) { |
| 144 column.width = width; |
146 column.width = width; |
| |
147 } else if(width < 0) { |
| |
148 column.resizingMask = NSTableColumnAutoresizingMask | NSTableColumnUserResizingMask; |
| 145 } |
149 } |
| 146 if(type >= UI_ICON) { |
150 if(type >= UI_ICON) { |
| 147 // TODO |
151 // TODO |
| 148 } |
152 } |
| 149 [tableview addTableColumn:column]; |
153 [tableview addTableColumn:column]; |