File tree Expand file tree Collapse file tree 8 files changed +317
-72
lines changed
Expand file tree Collapse file tree 8 files changed +317
-72
lines changed Original file line number Diff line number Diff line change 9292 <DependentUpon >EditTextView.cs</DependentUpon >
9393 </Compile >
9494 <Compile Include =" TestData.cs" />
95+ <Compile Include =" ListViewCell.cs" />
96+ <Compile Include =" ListViewCell.designer.cs" >
97+ <DependentUpon >ListViewCell.cs</DependentUpon >
98+ </Compile >
9599 </ItemGroup >
96100 <ItemGroup >
97101 <InterfaceDefinition Include =" Main.storyboard" />
98102 <InterfaceDefinition Include =" DragAndDropView.xib" />
99103 <InterfaceDefinition Include =" EditTextView.xib" />
104+ <InterfaceDefinition Include =" ListViewCell.xib" />
100105 </ItemGroup >
101106 <ItemGroup >
102107 <ProjectReference Include =" ..\Library\Library.csproj" >
Original file line number Diff line number Diff line change @@ -34,12 +34,17 @@ void Initialize()
3434
3535 #endregion
3636
37+ public override void MouseDown ( NSEvent theEvent )
38+ {
39+ base . MouseDown ( theEvent ) ;
40+
41+ Window . MakeFirstResponder ( this ) ;
42+ }
43+
3744#if true
3845 public override void AwakeFromNib ( )
3946 {
4047 base . AwakeFromNib ( ) ;
41-
42- UnregisterDraggedTypes ( ) ;
4348 }
4449
4550 public override string [ ] RegisteredDragTypes ( )
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using Foundation ;
5+ using AppKit ;
6+
7+ namespace SharpCpp
8+ {
9+ public partial class ListViewCell : AppKit . NSTableCellView
10+ {
11+ #region Constructors
12+
13+ // Called when created from unmanaged code
14+ public ListViewCell ( IntPtr handle ) : base ( handle )
15+ {
16+ Initialize ( ) ;
17+ }
18+
19+ // Called when created directly from a XIB file
20+ [ Export ( "initWithCoder:" ) ]
21+ public ListViewCell ( NSCoder coder ) : base ( coder )
22+ {
23+ Initialize ( ) ;
24+ }
25+
26+ // Shared initialization code
27+ void Initialize ( )
28+ {
29+ }
30+
31+ #endregion
32+
33+ public void SetFilename ( string filename , bool selected )
34+ {
35+ // Very simplified version how to select text
36+ var size = NSFont . SystemFontSize ;
37+
38+ if ( selected ) {
39+ Label . Font = NSFont . BoldSystemFontOfSize ( size ) ;
40+ } else {
41+ Label . Font = NSFont . SystemFontOfSize ( size ) ;
42+ }
43+
44+ Label . StringValue = filename ;
45+ }
46+ }
47+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <document type =" com.apple.InterfaceBuilder3.Cocoa.XIB" version =" 3.0" toolsVersion =" 11762" systemVersion =" 16D32" targetRuntime =" MacOSX.Cocoa" propertyAccessControl =" none" >
3+ <dependencies >
4+ <deployment identifier =" macosx" />
5+ <plugIn identifier =" com.apple.InterfaceBuilder.CocoaPlugin" version =" 11762" />
6+ <capability name =" documents saved in the Xcode 8 format" minToolsVersion =" 8.0" />
7+ </dependencies >
8+ <objects >
9+ <customObject id =" -2" userLabel =" File's Owner" customClass =" ListViewCell" />
10+ <customObject id =" -1" userLabel =" First Responder" customClass =" FirstResponder" />
11+ <customObject id =" -3" userLabel =" Application" customClass =" NSObject" />
12+ <customView misplaced =" YES" id =" 2" customClass =" ListViewCell" >
13+ <rect key =" frame" x =" 0.0" y =" 0.0" width =" 209" height =" 199" />
14+ <autoresizingMask key =" autoresizingMask" flexibleMinX =" YES" flexibleMaxX =" YES" flexibleMinY =" YES" />
15+ <subviews >
16+ <textField horizontalHuggingPriority =" 251" verticalHuggingPriority =" 750" misplaced =" YES" allowsCharacterPickerTouchBarItem =" NO" id =" Wh4-6p-M0i" >
17+ <rect key =" frame" x =" 16" y =" 91" width =" 175" height =" 17" />
18+ <autoresizingMask key =" autoresizingMask" flexibleMinX =" YES" flexibleMaxX =" YES" flexibleMinY =" YES" flexibleMaxY =" YES" />
19+ <textFieldCell key =" cell" scrollable =" YES" lineBreakMode =" clipping" sendsActionOnEndEditing =" YES" alignment =" left" title =" Label" allowsEditingTextAttributes =" YES" id =" AW7-nL-LxK" >
20+ <font key =" font" metaFont =" system" />
21+ <color key =" textColor" name =" labelColor" catalog =" System" colorSpace =" catalog" />
22+ <color key =" backgroundColor" red =" 1" green =" 0.35417509178555395" blue =" 0.0" alpha =" 1" colorSpace =" custom" customColorSpace =" sRGB" />
23+ </textFieldCell >
24+ </textField >
25+ </subviews >
26+ <connections >
27+ <outlet property =" Label" destination =" Wh4-6p-M0i" id =" Gif-LU-H7p" />
28+ </connections >
29+ <point key =" canvasLocation" x =" 71.5" y =" 131.5" />
30+ </customView >
31+ </objects >
32+ </document >
You can’t perform that action at this time.
0 commit comments