public Id transformedValue(Id value)
        {
            NSString archStr;

            switch (value.SendMessage<NSMachOArchitecture>("intValue"))
            {
                case NSMachOArchitecture.NSBundleExecutableArchitectureI386:
                    archStr = @"Intel 32-bit";
                    break;
                case NSMachOArchitecture.NSBundleExecutableArchitectureX86_64:
                    archStr = @"Intel 64-bit";
                    break;
                case NSMachOArchitecture.NSBundleExecutableArchitecturePPC:
                    // in case of Rosetta, allow for PPC
                    archStr = @"PPC Translated";
                    break;
                default:
                    archStr = @"unknown";
                    break;
            }

            return archStr;
        }
Ejemplo n.º 2
0
partial         void DoFind(Id sender)
        {
            if (this._pdfView.Document.IsFinding)
            {
                this._pdfView.Document.CancelFindString();
            }

            // Lazily allocate _searchResults.
            if (this._searchResults == null)
            {
                this._searchResults = NSMutableArray.ArrayWithCapacity(10).Retain<NSMutableArray>();
            }

            NSString value = sender.SendMessage<NSString>("stringValue");
            this._pdfView.Document.BeginFindStringWithOptions(value, (int) NSStringCompareOptions.NSCaseInsensitiveSearch);
        }
partial         void SwitchView(Id sender)
        {
            // Figure out the new view, the old view, and the new size of the window
            int tag = sender.SendMessage<int>("tag");
            NSView view = this.ViewForTag(tag);
            NSView previousView = this.ViewForTag(this.currentViewTag);
            this.currentViewTag = tag;

            NSRect newFrame = this.NewFrameForNewContentView(view);

            // Using an animation grouping because we may be changing the duration
            NSAnimationContext.BeginGrouping();

            // With the shift key down, do slow-mo animation
            if ((NSApplication.NSApp.CurrentEvent.ModifierFlags & NSModifierFlags.NSShiftKeyMask) == NSModifierFlags.NSShiftKeyMask)
            {
                NSAnimationContext.CurrentContext.Duration = 1.0f;
            }

            // Call the animator instead of the view / window directly
            this.Window.ContentView.Animator.ReplaceSubviewWith(previousView, view);
            this.Window.Animator.SetFrameDisplay(newFrame, true);

            NSAnimationContext.EndGrouping();
        }
Ejemplo n.º 4
0
partial         void ChangeLayout(Id sender)
        {
            this.LayoutStyle = (LayoutStyle) sender.SendMessage<int>("selectedTag");
        }
 public void ShuffleTitleOfSender(Id sender)
 {
     NSArray strings = NSArray.ArrayWithObjects ((NSString)"S", (NSString)"Short", (NSString)"Absolutely ginormous string (for a button)", null);
     NSInteger previousStringIndex = strings.IndexOfObject (sender.SendMessage<NSString> ("title"));
     NSInteger nextStringIndex;
     if (previousStringIndex == NSUInteger.NSNotFound) {
         nextStringIndex = 0;
     } else {
         nextStringIndex = (previousStringIndex + 1) % 3;
     }
     sender.SendMessage ("setTitle:", strings.ObjectAtIndex (nextStringIndex));
 }
Ejemplo n.º 6
0
        public Id transformedValue(Id value)
        {
            bool b = value.SendMessage<bool>("boolValue");

            return b ? YES : NO;
        }