Up

# NSBox

### Authors

Scott Christley (`scottc@net-community.com`)

> Simple box view that can display a border and title

Copyright: (C) 1996 Free Software Foundation, Inc.

# Software documentation for the NSBox class

## NSBox : NSView

> Declared in:
>   AppKit/NSBox.h

> Conforms to:
>   NSCoding

Availability: OpenStep

TODO : Description

Instance Variables
Method summary

- -borderRect
- -borderType
- -boxType
- -contentView
- -contentViewMargins
- -minimumSize
- -setBorderType:
- -setBoxType:
- -setContentView:
- -setContentViewMargins:
- -setFrameFromContentFrame:
- -setTitle:
- -setTitleFont:
- -setTitlePosition:
- -setTitleWithMnemonic:
- -sizeToFit
- -title
- -titleCell
- -titleFont
- -titlePosition
- -titleRect

### borderRect

- (NSRect) borderRect;
Availability: OpenStep

Returns the border rectangle of the box.

### borderType

- (NSBorderType) borderType;
Availability: OpenStep

Returns the NSBox's border type. See NSBorderType for more information. The default border type is NSGrooveBorder .

See Also: -setBorderType:

### boxType

- (NSBoxType) boxType;
Availability: MacOS-X 10.0.0
Description forthcoming.

### contentView

- (id) contentView;
Availability: OpenStep

Returns the NSBox's content view. The content view is created as NSView when the box is initialized. The contentView is resizes when needed.

See Also: -setContentView:

### contentViewMargins

- (NSSize) contentViewMargins;
Availability: OpenStep

Returns an NSSize containing the interior margins of the receiver. An NSBox's content view margins are empty space that is subtracted from the top, bottom, and sides as padding between the inside of the box and the frame of its content view.

See Also: -setContentViewMargins:

### minimumSize

- (NSSize) minimumSize;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### setBorderType:

- (void) setBorderType: (NSBorderType)aType;
Availability: OpenStep

Sets the border type to aType, resizes the content view frame if needed, and marks self for display. See NSBorderType for more informations The default boder type is NSGrooveBorder .

See Also: -borderType

### setBoxType:

- (void) setBoxType: (NSBoxType)aType;
Availability: MacOS-X 10.0.0
Description forthcoming.

### setContentView:

- (void) setContentView: (NSView*)aView;
Availability: OpenStep

Sets the content view to aView. The current content view is replaced by -replaceSubview:with: . So you should -retain the current view if you want to use it later. The contentView frame is resized if needed.

See Also: -contentView

### setContentViewMargins:

- (void) setContentViewMargins: (NSSize)offsetSize;
Availability: OpenStep

Sets the NSSize containing the interior margins to offsetSize. An NSBox's content view margins are empty space that is subtracted from the top, bottom, and sides as padding between the inside of the box and the frame of its content view

See Also: -contentViewMargins

### setFrameFromContentFrame:

- (void) setFrameFromContentFrame: (NSRect)contentFrame;
Availability: OpenStep

Resizes the NSBox to fit the content view frame contentFrame.

### setTitle:

- (void) setTitle: (NSString*)aString;
Availability: OpenStep

Sets the title cell to aString, resizes the content view frame if needed and marks self for display.

Warning: This method does not implement the Cocoa behaviour

See Also: -title [NSCell -setStringValue:]

### setTitleFont:

- (void) setTitleFont: (NSFont*)fontObj;
Availability: OpenStep

Sets the title cell font to fontObj, resizes the content view frame if needed and marks self for display.

See Also: -titleFont [NSCell -setFont:]

### setTitlePosition:

- (void) setTitlePosition: (NSTitlePosition)aPosition;
Availability: OpenStep

Sets the title cell position to aPosition , resizes the content view frame if needed and marks self for display. See NSTitlePosition for more information. The default position is NSAtTop .

See Also: -titlePosition

### setTitleWithMnemonic:

- (void) setTitleWithMnemonic: (NSString*)aString;
Availability: MacOS-X 10.0.0
Description forthcoming.

### sizeToFit

- (void) sizeToFit;
Availability: OpenStep

Resizes the NSBox and its content view to fit its subviews.

### title

- (NSString*) title;
Availability: OpenStep

Returns title cell string value.

See Also: -setTitle: [NSCell -stringValue]

### titleCell

- (id) titleCell;
Availability: OpenStep

Returns the title cell

### titleFont

- (NSFont*) titleFont;
Availability: OpenStep

Returns the title cell font.

See Also: -setTitleFont: [NSCell -font]

### titlePosition

- (NSTitlePosition) titlePosition;
Availability: OpenStep

Returns the title position. See NSTitlePosition for more information. The default position is NSAtTop

See Also: -setTitlePosition:

### titleRect

- (NSRect) titleRect;
Availability: OpenStep

Returns the title rectangle

## Instance Variables for NSBox Class

### _border_rect

@protected NSRect _border_rect;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _border_type

@protected NSBorderType _border_type;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _box_type

@protected NSBoxType _box_type;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _cell

@protected id _cell;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _content_view

@protected id _content_view;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _offsets

@protected NSSize _offsets;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _title_position

@protected NSTitlePosition _title_position;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _title_rect

@protected NSRect _title_rect;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

Up