AppKitAddition

Adds extended image and color handling features to Xojo controls. Currently PushButton, RadioButton, PopupMenu, Window, MenuItem and SegmentedControl.

Module

macOS only! Some features are available for Windows too but physically located in User32Addition.

Overview

Classes

Methods

Enumerations

Documentation

Methods

Alpha (extends w As Window / RectControl, Assigns Value As Integer) / As Integer

Sets the transparency value of a Window or a RectControl to a value similar to a Xojo Color Alpha value. Works like a property, which means both is valid:

Dim Alpha As Integer = Window1.Alpha Canvas1.Alpha = 230

Use the MakeTransparent method on Windows for similar results.

AlternateImage(extends As PushButton / RadioButton, assigns pic As Picture)

An alternate image that appears on the button when the button is in an on state. Example:

me.AlternativeImage = myPicture

AlternateTemplate(extends As PushButton / RadioButton, assigns pic As Picture)

Like alternate image, but the template representation of the image is used. Example:

me.AlternativeTemplate = myPicture

AlternateTitle(extends b As PushButton / RadioButton, assigns value As String) / As String

The title that the button displays when the button is in an on state. Works like a property, which means from inside a pusbutton:

me.AlternateTitle = "Systems online" Dim s as String = me.AlternateTitle

BringToFront (extends w As Window) [mac + win]

Brings a window to the foreground.

Content (extends p As Popupmenu, Index As Integer, assigns value As ContainerControl)

Assigns an containercontrol as a contentview to the item at the specified index of a popupmenu. Reset to normal cell by assigning Nil.

Draw(extends p As Picture, optional g As Graphics, x As Double, y As Double, width As Double, height As Double, x1 As Double = 0, y1 As Double = 0, sourceWidth As Double = -1, sourceHeight As Double = -1, Operation as NSCompositingOperation = NSCompositingOperation.clear, Opacity as Double = 1

Draws the picture in the specified rectangle of the current CGGraphics context, with optional Blend Modes and opacity. Rest of the parameters are like graphics.DrawPicture. If g is defined, y values are inverted.

DrawAsTemplate(extends p As Picture, optional g As Graphics, x As Double, y As Double, width As Double, height As Double, x1 As Double = 0, y1 As Double = 0, sourceWidth As Double = -1, sourceHeight As Double = -1, Operation as NSCompositingOperation = NSCompositingOperation.clear, Opacity as Double = 1

DrawAsTemplate(extends p As Picture, x As Double, y As Double, width As Double, height As Double)

Like Picture.Draw in this mpdule, except for that the template representation of the picture is being used.

Image(extends s As MenuItem, Scaling As NSImagescaling = NSImagescaling.none, Position As NSCellImageposition = NSCellImageposition.imageleft, assigns Pic As Picture)

The image that appears on the menuitem when it’s in an off state, or nil if there should be no such image.

Use the Images method for Windows.

Image(extends p As PopupMenu, Index As Integer, Scaling As AppkitAddition.NSImageScaling = AppkitAddition.NSImageScaling.None, Position As AppkitAddition.NSCellImagePosition = AppkitAddition.NSCellImagePosition.ImageLeft, assigns value As Picture)

Assigns an image to item at index of a popupmenu.

Image(extends s As PushButton / RadioButton, scaling As NSImageScaling = NSImageScaling.None, position As NSCellImageposition = NSCellImageposition.imageleft, assigns pic As Picture) [mac + win]

Sets the image that appears on the button when it’s in an off state, or nil if there is no such image.

Scaling and Position are ignored on Windows.

This currently crashes the project under Windows silently when an image or template is assigned second time to a button – because of getting its handle, not because of the declare.

Image(extends s As SegmentedControl, Index as integer, scaling as NSImageScaling = NSImagescaling.ProportionallyUpOrDown, assigns pic As Picture)

Sets the image of a segment to pic, using the specified scaling method.

ImageHugsTitle(extends b As PushButton / RadioButton, assigns value As Boolean) / As Boolean

A Boolean value that determines how the button’s image and title are positioned together within the button bezel. Available since macOS 10.12.

me.ImageHugsTitle = True" Dim b as Boolean = me.ImageHugsTitle

ImagePosition(extends b As PushButton / Radiobutton, assigns value As NSCellImagePosition) / As NSCellImagePosition

Determines how image and title are placed inside a button cell.

me.ImagePosition = AppKitAddition.NSCellImagePosition.ImageLeft Dim p as AppKitAddition.NSCellImagePosition = me.ImagePosition

Images(extends parent As Menuitem, s As Menuitem, assigns pics() As Picture) [mac + win]

Sets the offstate and onstate images for a menuitem. Here for compatibility with the Windows equivalent.

ImageScaling(extends b As PushButton / RadioButton, assigns value As NSImageScaling) / As NSImageScaling

The scaling mode applied to make the cell’s image fit the frame of the image view.

me.ImageScaling = AppKitAddition.NSImageScaling.None Dim s as AppKitAddition.NSImageScaling = me.ImageScaling

MixedStateImage(extends s As MenuItem, assigns Pic As Picture)

The image of the menuitem that indicates a "mixed” state.

SizeToFit(extends r As RectControl)

Resizes a control to the size accomodating its content, if possible.

Currently available for Push- and RadioButtons on Windows.

Style(extends p As PopupMenu, Assigns value As AppKitAddition.PopupMenuStyle) / As AppKitAddition.PopupMenuStyle

Gets/sets the style of a popupmenu.

Template(extends s As PushButton, scaling As NSImageScaling = NSImageScaling.ProportionallyUpOrDown, position As NSCellImageposition = NSCellImageposition.imageleft, assigns pic As Picture) [mac + win]

Identical to Image, only that here the template representation of the image is being used. (on Windows the ICON handle if possible)

This currently crashes the project under Windows silently when an image or template is assigned second time to a button – because of getting its handle, not because of the declare.

Template(extends s As SegmentedControl, Index as integer, scaling as NSImageScaling = NSImagescaling.ProportionallyUpOrDown, assigns pic As Picture)

Identical to Image, only that here the template representation of the image is being used.

Enumerations

NSBackgroundStyle

A style for the background appearance of a control. Values:

NSCellImagePosition

Works together with ImagePosition, Image and Template methods. Values:

NSCompositingOperation

Blend mode for the Picture.Draw… methods. See https://developer.apple.com/documentation/appkit/nscompositingoperation

NSImageScaling

Values for the ImageScaling methods:

PopupMenuStyle

Last updated