Debian Codegraph @

hiro/cocoa/widget/table-view.hpp

raw
1 #if defined(Hiro_TableView)
2
3 @class CocoaTableViewContent;
4
5 @interface CocoaTableView : NSScrollView <NSTableViewDelegate, NSTableViewDataSource> {
6 @public
7 hiro::mTableView* tableView;
8 CocoaTableViewContent* content;
9 NSFont* font;
10 }
11 -(id) initWith:(hiro::mTableView&)tableViewReference;
12 -(CocoaTableViewContent*) content;
13 -(NSFont*) font;
14 -(void) setFont:(NSFont*)font;
15 -(void) reloadColumns;
16 -(NSInteger) numberOfRowsInTableView:(NSTableView*)table;
17 -(id) tableView:(NSTableView*)table objectValueForTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row;
18 -(BOOL) tableView:(NSTableView*)table shouldShowCellExpansionForTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row;
19 -(NSString*) tableView:(NSTableView*)table toolTipForCell:(NSCell*)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation;
20 -(void) tableView:(NSTableView*)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn row:(NSInteger)row;
21 -(void) tableViewSelectionDidChange:(NSNotification*)notification;
22 -(IBAction) doubleAction:(id)sender;
23 @end
24
25 @interface CocoaTableViewContent : NSTableView {
26 hiro::mTableView* tableView;
27 }
28 -(id) initWith:(hiro::mTableView&)tableViewReference;
29 -(void) reloadData;
30 -(void) keyDown:(NSEvent*)event;
31 -(NSMenu*) menuForEvent:(NSEvent*)event;
32 @end
33
34 @interface CocoaTableViewCell : NSCell {
35 hiro::mTableView* tableView;
36 NSButtonCell* buttonCell;
37 NSTextFieldCell* textCell;
38 }
39 -(id) initWith:(hiro::mTableView&)tableViewReference;
40 -(NSString*) stringValue;
41 -(void) drawWithFrame:(NSRect)frame inView:(NSView*)view;
42 -(NSUInteger) hitTestForEvent:(NSEvent*)event inRect:(NSRect)frame ofView:(NSView*)view;
43 -(BOOL) trackMouse:(NSEvent*)event inRect:(NSRect)frame ofView:(NSView*)view untilMouseUp:(BOOL)flag;
44 +(BOOL) prefersTrackingUntilMouseUp;
45 @end
46
47 namespace hiro {
48
49 struct pTableView : pWidget {
50 Declare(TableView, Widget)
51
52 auto append(sTableViewColumn column) -> void;
53 auto append(sTableViewItem item) -> void;
54 auto remove(sTableViewColumn column) -> void;
55 auto remove(sTableViewItem item) -> void;
56 auto resizeColumns() -> void;
57 auto setAlignment(Alignment alignment) -> void;
58 auto setBackgroundColor(Color color) -> void;
59 auto setBatchable(bool batchable) -> void;
60 auto setBordered(bool bordered) -> void;
61 auto setEnabled(bool enabled) -> void override;
62 auto setFont(const Font& font) -> void override;
63 auto setForegroundColor(Color color) -> void;
64 auto setHeadered(bool headered) -> void;
65 auto setSortable(bool sortable) -> void;
66 auto setUsesSidebarStyle(bool usesSidebarStyle) -> void;
67
68 auto _cellWidth(u32 row, u32 column) -> u32;
69 auto _columnWidth(u32 column) -> u32;
70 auto _width(u32 column) -> u32;
71
72 CocoaTableView* cocoaTableView = nullptr;
73 };
74
75 }
76
77 #endif