3030using System . Linq ;
3131using System . Collections . Generic ;
3232
33+ using Foundation ;
3334using Gtk ;
3435
3536using Mono . Debugging . Client ;
@@ -56,6 +57,7 @@ class ExceptionCaughtDialog : Gtk.Window
5657 VBox vboxAroundInnerExceptionMessage , rightVBox , container ;
5758 Button close , helpLinkButton , innerExceptionHelpLinkButton ;
5859 TreeView exceptionValueTreeView , stackTraceTreeView ;
60+ MacObjectValueTreeView macExceptionValueTreeView ;
5961 Expander expanderProperties , expanderStacktrace ;
6062 InnerExceptionsTree innerExceptionsTreeView ;
6163 ObjectValueTreeViewController controller ;
@@ -181,12 +183,17 @@ protected override void OnSizeAllocated (Gdk.Rectangle allocation)
181183
182184 Widget CreateExceptionValueTreeView ( )
183185 {
186+ Widget scrolledWidget = null ;
184187 if ( useNewTreeView ) {
185188 controller = new ObjectValueTreeViewController ( ) ;
186189 controller . SetStackFrame ( DebuggingService . CurrentFrame ) ;
187190 controller . AllowExpanding = true ;
188191
189- exceptionValueTreeView = controller . GetGtkControl ( ObjectValueTreeViewFlags . ExceptionCaughtFlags ) ;
192+ if ( Platform . IsMac ) {
193+ macExceptionValueTreeView = controller . GetMacControl ( ObjectValueTreeViewFlags . ObjectValuePadFlags ) ;
194+ } else {
195+ exceptionValueTreeView = controller . GetGtkControl ( ObjectValueTreeViewFlags . ExceptionCaughtFlags ) ;
196+ }
190197 } else {
191198 var objValueTreeView = new ObjectValueTreeView ( ) ;
192199 objValueTreeView . Frame = DebuggingService . CurrentFrame ;
@@ -199,26 +206,54 @@ Widget CreateExceptionValueTreeView ()
199206 exceptionValueTreeView = objValueTreeView ;
200207 }
201208
202- exceptionValueTreeView . ModifyBase ( StateType . Normal , Styles . ExceptionCaughtDialog . ValueTreeBackgroundColor . ToGdkColor ( ) ) ;
203- exceptionValueTreeView . ModifyBase ( StateType . Active , Styles . ObjectValueTreeActiveBackgroundColor . ToGdkColor ( ) ) ;
204- exceptionValueTreeView . ModifyFont ( Pango . FontDescription . FromString ( Platform . IsWindows ? "9" : "11" ) ) ;
205- exceptionValueTreeView . RulesHint = false ;
206- exceptionValueTreeView . CanFocus = true ;
207- exceptionValueTreeView . Show ( ) ;
208-
209- var scrolled = new ScrolledWindow {
210- HeightRequest = 180 ,
211- CanFocus = true ,
212- HscrollbarPolicy = PolicyType . Automatic ,
213- VscrollbarPolicy = PolicyType . Automatic
214- } ;
215-
216- scrolled . ShadowType = ShadowType . None ;
217- scrolled . Add ( exceptionValueTreeView ) ;
218- scrolled . Show ( ) ;
209+ if ( useNewTreeView && Platform . IsMac ) {
210+ var scrolled = new AppKit . NSScrollView {
211+ DocumentView = macExceptionValueTreeView ,
212+ AutohidesScrollers = false ,
213+ HasVerticalScroller = true ,
214+ HasHorizontalScroller = true ,
215+ } ;
216+
217+ // disable implicit animations
218+ scrolled . WantsLayer = true ;
219+ scrolled . Layer . Actions = new NSDictionary (
220+ "actions" , NSNull . Null ,
221+ "contents" , NSNull . Null ,
222+ "hidden" , NSNull . Null ,
223+ "onLayout" , NSNull . Null ,
224+ "onOrderIn" , NSNull . Null ,
225+ "onOrderOut" , NSNull . Null ,
226+ "position" , NSNull . Null ,
227+ "sublayers" , NSNull . Null ,
228+ "transform" , NSNull . Null ,
229+ "bounds" , NSNull . Null ) ;
230+
231+ var host = new GtkNSViewHost ( scrolled ) ;
232+ host . ShowAll ( ) ;
233+ scrolledWidget = host ;
234+ } else {
235+ exceptionValueTreeView . ModifyBase ( StateType . Normal , Styles . ExceptionCaughtDialog . ValueTreeBackgroundColor . ToGdkColor ( ) ) ;
236+ exceptionValueTreeView . ModifyBase ( StateType . Active , Styles . ObjectValueTreeActiveBackgroundColor . ToGdkColor ( ) ) ;
237+ exceptionValueTreeView . ModifyFont ( Pango . FontDescription . FromString ( Platform . IsWindows ? "9" : "11" ) ) ;
238+ exceptionValueTreeView . RulesHint = false ;
239+ exceptionValueTreeView . CanFocus = true ;
240+ exceptionValueTreeView . Show ( ) ;
241+
242+ var scrolled = new ScrolledWindow {
243+ HeightRequest = 180 ,
244+ CanFocus = true ,
245+ HscrollbarPolicy = PolicyType . Automatic ,
246+ VscrollbarPolicy = PolicyType . Automatic
247+ } ;
248+
249+ scrolled . ShadowType = ShadowType . None ;
250+ scrolled . Add ( exceptionValueTreeView ) ;
251+ scrolled . Show ( ) ;
252+ scrolledWidget = scrolled ;
253+ }
219254
220255 var vbox = new VBox ( ) ;
221- expanderProperties = WrapInExpander ( GettextCatalog . GetString ( "Properties" ) , scrolled ) ;
256+ expanderProperties = WrapInExpander ( GettextCatalog . GetString ( "Properties" ) , scrolledWidget ) ;
222257 vbox . PackStart ( new VBox ( ) , false , false , 5 ) ;
223258 vbox . PackStart ( expanderProperties , true , true , 0 ) ;
224259 vbox . ShowAll ( ) ;
0 commit comments