mac-samples/Rulers
Craig a6577adcdf sample metadata schema fix (remove tech) 2019-07-19 18:59:42 -07:00
..
Screenshots Added some screenshots 2012-12-11 17:39:08 -05:00
.gitignore Move one dir up 2010-11-14 19:26:54 -05:00
AppDelegate.cs Macsamples migrated to unified with tool 2014-11-21 20:09:57 -05:00
ColorRect.cs Macsamples migrated to unified with tool 2014-11-21 20:09:57 -05:00
EdgeMarkerBottom.tiff Move one dir up 2010-11-14 19:26:54 -05:00
EdgeMarkerLeft.tiff Move one dir up 2010-11-14 19:26:54 -05:00
EdgeMarkerRight.tiff Move one dir up 2010-11-14 19:26:54 -05:00
EdgeMarkerTop.tiff Move one dir up 2010-11-14 19:26:54 -05:00
Info.plist Updated min deployment version (#113) 2018-11-15 03:52:17 -05:00
Main.cs Macsamples migrated to unified with tool 2014-11-21 20:09:57 -05:00
MainMenu.xib Move one dir up 2010-11-14 19:26:54 -05:00
MainMenu.xib.designer.cs Macsamples migrated to unified with tool 2014-11-21 20:09:57 -05:00
Metadata.xml Add brief description tag to metadata.xml 2015-04-16 15:35:20 -04:00
MyWindow.cs Macsamples migrated to unified with tool 2014-11-21 20:09:57 -05:00
MyWindow.xib Move one dir up 2010-11-14 19:26:54 -05:00
MyWindow.xib.designer.cs Macsamples migrated to unified with tool 2014-11-21 20:09:57 -05:00
MyWindowController.cs Macsamples migrated to unified with tool 2014-11-21 20:09:57 -05:00
NestleView.cs Macsamples migrated to unified with tool 2014-11-21 20:09:57 -05:00
README.md sample metadata schema fix (remove tech) 2019-07-19 18:59:42 -07:00
RectsView.cs Macsamples migrated to unified with tool 2014-11-21 20:09:57 -05:00
Rulers.csproj Set HttpClientHandler to NSUrlSessionHandler for all samples 2018-05-02 13:22:24 -06:00
Rulers.sln Manually upgrade the solutions 2012-01-26 23:54:36 -05:00

README.md

name description page_type languages products urlFragment
Xamarin.Mac - Rulers This project demonstrates many of the interactions between an NSRulerView and its client view. It should give you an idea how to go about this when... sample
csharp
xamarin
rulers

Rulers

This project demonstrates many of the interactions between an NSRulerView and its client view. It should give you an idea how to go about this when creating a view subclass that really does something.

The principal class, RectsView, displays colored rectangles that the user can select and drag around. The RectsView puts markers in the horizontal and vertical rulers showing the placement of the rectangle; manipulating these markers changes the size of the selected rectangle. Removing a marker deletes the selected rectangle, and clicking in the ruler area creates a new rectangle. The user can also lock a rectangle down, so that the markers can't be moved.

RectsView.m defines a lot of methods, but these are the ones primarily related to working with NSRulerViews:

Methods Description

  • rulerView: shouldMoveMarker: - Denies move if no selection or if selection is locked.
  • rulerView: willMoveMarker: toLocation: - Limits minimum rectangle size and updates display; try changing this to snap markers to whole units.
  • rulerView: didMoveMarker: - Refreshes ruler display.
  • rulerView: shouldRemoveMarker: - Denies remove of no selection or if selection is locked.
  • rulerView: didRemoveMarker: - Deletes the selected rectangle and refreshes the display.
  • rulerView: shouldAddMarker: - Returns YES, always allowing new rectangles to be added.
  • rulerView: willAddMarker: atLocation: - Returns the proposed location unchanged; try changing this to snap markers to whole units.
  • rulerView: didAddMarker: - Creates a new rectangle.
  • rulerView: handleMouseDown: - Adds a new marker to be tracked.
  • rulerView: willSetClientView: - Does nothing.