Пример #1
0
        public void Draw(NSRect aCellFrame, NSView aControlView)
        {
            this.TextColor = NSColor.WhiteColor;
            this.Font      = FontManager.FontSemiLarge;

            NSRect imageFrame = new NSRect(aCellFrame.MinX + 3, aCellFrame.MinY + 3, aCellFrame.Height - 6, aCellFrame.Height - 6);
            NSRect textFrame  = new NSRect(imageFrame.MaxX + 6, imageFrame.MinY, aCellFrame.Width - aCellFrame.MinX - aCellFrame.Height - 6, aCellFrame.Height - 6);

            SourceData data = this.RepresentedObject.CastAs <SourceData>();

            if (data.Image != null)
            {
                imageFrame = ImageRect(data.Image, imageFrame);
                data.Image.SendMessage("drawInRect:fromRect:operation:fraction:respectFlipped:hints:", imageFrame, NSRect.NSZeroRect, NSCompositingOperation.NSCompositeSourceOver, 1.0f, true, null);
            }

            this.SendMessageSuper(ThisClass, "drawWithFrame:inView:", textFrame, aControlView);
        }
Пример #2
0
        private void ModelChanged(object sender, EventArgs e)
        {
            // clear existing source list
            iSources.Release();
            iSources = new NSMutableArray();

            // add current list of sources
            foreach (Linn.Kinsky.Source source in iModel.Items)
            {
                SourceData data = new SourceData(source);
                iSources.AddObject(data);
                data.Release();
            }

            // notify that there has been a change in the source list **before** the change in selection
            WillChangeValueForKey(NSString.StringWithUTF8String("sources"));
            DidChangeValueForKey(NSString.StringWithUTF8String("sources"));

            WillChangeValueForKey(NSString.StringWithUTF8String("selectionIndices"));
            DidChangeValueForKey(NSString.StringWithUTF8String("selectionIndices"));
        }
Пример #3
0
        public void TableViewDidClickRow(NSTableView aView, int aCol, int aRow)
        {
            // ignore clicks on the table background
            if (aRow == -1)
            {
                return;
            }

            // extended delegate function that is called on a mouse up - see
            // the TableViewClickable implementation
            SourceData data = iSources.ObjectAtIndex((uint)aRow).CastAs <SourceData>();

            if (SelectedIndex != aRow)
            {
                // unselected row clicked
                iModel.SelectedItem = data.Source;
            }

            // always close the popover
            if (EventClose != null)
            {
                EventClose(this, EventArgs.Empty);
            }
        }