Improves Cocoa bindings
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@460 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
997a9ff8c0
commit
e6a44368b5
@ -1,132 +1,359 @@
|
||||
{%mainunit appkit.pas}
|
||||
{
|
||||
(*
|
||||
NSStatusItem.h
|
||||
Application Kit
|
||||
Copyright (c) 1997-2005, Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
}
|
||||
*)
|
||||
|
||||
{$ifdef HEADER}
|
||||
{$ifndef NSSTATUSITEM_PAS_H}
|
||||
{$define NSSTATUSITEM_PAS_H}
|
||||
|
||||
{#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>}
|
||||
|
||||
(*typedef struct {
|
||||
unsigned int customView:1;
|
||||
unsigned int highlightMode:1;
|
||||
unsigned int hasAlternateImage:1;
|
||||
unsigned int reserved:29;
|
||||
} _SBIFlags; *)
|
||||
|
||||
{ Class and method name strings }
|
||||
const
|
||||
Str_NSStatusItem = 'NSStatusItem';
|
||||
|
||||
Str_setImage = 'setImage:';
|
||||
|
||||
{$endif}
|
||||
{$endif}
|
||||
{$ifdef CLASSES}
|
||||
{$ifndef NSSTATUSITEM_PAS_C}
|
||||
{$define NSSTATUSITEM_PAS_C}
|
||||
|
||||
{@class NSAttributedString;
|
||||
@class NSImage;
|
||||
@class NSMenu;}
|
||||
// NSStatusBar = class;
|
||||
{@class NSString;
|
||||
@class NSView;
|
||||
@class NSWindow;}
|
||||
|
||||
NSStatusItem = class(NSObject)
|
||||
public
|
||||
{ Extra binding functions }
|
||||
class function getClass: objc.id; override;
|
||||
public
|
||||
|
||||
{- (NSStatusBar*) statusBar;
|
||||
|
||||
- (float) length;
|
||||
- (void) setLength:(float)length;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSStatusItem (NSStatusItemCommon)
|
||||
|
||||
- (SEL) action;
|
||||
- (void) setAction:(SEL)action;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
- (SEL) doubleAction;
|
||||
- (void) setDoubleAction:(SEL)action;
|
||||
#endif
|
||||
|
||||
- (id) target;
|
||||
- (void) setTarget:(id)target;
|
||||
|
||||
- (NSString*) title;
|
||||
- (void) setTitle:(NSString*)title;
|
||||
|
||||
- (NSAttributedString*) attributedTitle;
|
||||
- (void) setAttributedTitle:(NSAttributedString*)title;
|
||||
|
||||
- (NSImage*) image;}
|
||||
procedure setImage(image: NSImage);
|
||||
|
||||
{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
||||
- (NSImage *)alternateImage;
|
||||
- (void)setAlternateImage:(NSImage*)image;
|
||||
#endif
|
||||
|
||||
- (NSMenu*) menu;
|
||||
- (void) setMenu:(NSMenu*)menu;
|
||||
|
||||
- (BOOL) isEnabled;
|
||||
- (void) setEnabled:(BOOL)enabled;
|
||||
|
||||
- (NSString*) toolTip;
|
||||
- (void) setToolTip:(NSString*)toolTip;
|
||||
|
||||
- (void) setHighlightMode:(BOOL) highlightMode;
|
||||
- (BOOL) highlightMode;
|
||||
|
||||
- (void) sendActionOn:(int)mask;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
|
||||
- (void) popUpStatusItemMenu:(NSMenu*)menu;
|
||||
- (void) drawStatusBarBackgroundInRect:(NSRect)rect withHighlight:(BOOL)highlight;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
@interface NSStatusItem (NSStatusItemView)
|
||||
|
||||
- (NSView*) view;
|
||||
- (void) setView:(NSView*)view;}
|
||||
|
||||
type
|
||||
_SBIFlags = packed record
|
||||
_bitflags1 : LongWord;
|
||||
end;
|
||||
|
||||
{$endif}
|
||||
{$endif}
|
||||
|
||||
{$ifdef FORWARD}
|
||||
{$ifndef NSSTATUSITEM_PAS__FORWARD}
|
||||
{$define NSSTATUSITEM_PAS__FORWARD}
|
||||
|
||||
NSStatusItem = class;
|
||||
{$endif}
|
||||
{$endif}
|
||||
|
||||
{$ifdef CLASSES}
|
||||
{$ifndef NSSTATUSITEM_PAS_C}
|
||||
{$define NSSTATUSITEM_PAS_C}
|
||||
|
||||
|
||||
{ NSStatusItem }
|
||||
|
||||
NSStatusItem = class(NSObject)
|
||||
public
|
||||
class function getClass: objc.id; override;
|
||||
function statusBar: objc.id;{NSStatusBar}
|
||||
function length: Single;
|
||||
procedure setLength(_length: Single);
|
||||
function action: SEL;
|
||||
procedure setAction(_action: SEL);
|
||||
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
|
||||
function doubleAction: SEL;
|
||||
procedure setDoubleAction(_action: SEL);
|
||||
{.$endif}
|
||||
function target: objc.id;
|
||||
procedure setTarget(_target: objc.id);
|
||||
function title: CFStringRef;
|
||||
procedure setTitle(_title: CFStringRef);
|
||||
function attributedTitle: objc.id;{NSAttributedString}
|
||||
procedure setAttributedTitle(_title: objc.id {NSAttributedString});
|
||||
function image: objc.id;{NSImage}
|
||||
procedure setImage(_image: objc.id {NSImage});
|
||||
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3}
|
||||
function alternateImage: objc.id;{NSImage}
|
||||
procedure setAlternateImage(_image: objc.id {NSImage});
|
||||
{.$endif}
|
||||
function menu: objc.id;{NSMenu}
|
||||
procedure setMenu(_menu: objc.id {NSMenu});
|
||||
function isEnabled: LongBool;
|
||||
procedure setEnabled(_enabled: LongBool);
|
||||
function toolTip: CFStringRef;
|
||||
procedure setToolTip(_toolTip: CFStringRef);
|
||||
procedure setHighlightMode(_highlightMode: LongBool);
|
||||
function highlightMode: LongBool;
|
||||
procedure sendActionOn(_mask: Integer);
|
||||
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3}
|
||||
procedure popUpStatusItemMenu(_menu: objc.id {NSMenu});
|
||||
procedure drawStatusBarBackgroundInRect_withHighlight(_rect: NSRect; _highlight: LongBool);
|
||||
{.$endif}
|
||||
function view: objc.id;{NSView}
|
||||
procedure setView(_view: objc.id {NSView});
|
||||
end;
|
||||
|
||||
{$endif}
|
||||
{$endif}
|
||||
|
||||
{$ifdef IMPLEMENTATION}
|
||||
const
|
||||
StrNSStatusItem_NSStatusItem = 'NSStatusItem';
|
||||
StrNSStatusItem_statusBar = 'statusBar';
|
||||
StrNSStatusItem_length = 'length';
|
||||
StrNSStatusItem_setLength = 'setLength:';
|
||||
|
||||
StrNSStatusItem_action = 'action';
|
||||
StrNSStatusItem_setAction = 'setAction:';
|
||||
StrNSStatusItem_doubleAction = 'doubleAction';
|
||||
StrNSStatusItem_setDoubleAction = 'setDoubleAction:';
|
||||
StrNSStatusItem_target = 'target';
|
||||
StrNSStatusItem_setTarget = 'setTarget:';
|
||||
StrNSStatusItem_title = 'title';
|
||||
StrNSStatusItem_setTitle = 'setTitle:';
|
||||
StrNSStatusItem_attributedTitle = 'attributedTitle';
|
||||
StrNSStatusItem_setAttributedTitle = 'setAttributedTitle:';
|
||||
StrNSStatusItem_image = 'image';
|
||||
StrNSStatusItem_setImage = 'setImage:';
|
||||
StrNSStatusItem_alternateImage = 'alternateImage';
|
||||
StrNSStatusItem_setAlternateImage = 'setAlternateImage:';
|
||||
StrNSStatusItem_menu = 'menu';
|
||||
StrNSStatusItem_setMenu = 'setMenu:';
|
||||
StrNSStatusItem_isEnabled = 'isEnabled';
|
||||
StrNSStatusItem_setEnabled = 'setEnabled:';
|
||||
StrNSStatusItem_toolTip = 'toolTip';
|
||||
StrNSStatusItem_setToolTip = 'setToolTip:';
|
||||
StrNSStatusItem_setHighlightMode = 'setHighlightMode:';
|
||||
StrNSStatusItem_highlightMode = 'highlightMode';
|
||||
StrNSStatusItem_sendActionOn = 'sendActionOn:';
|
||||
StrNSStatusItem_popUpStatusItemMenu = 'popUpStatusItemMenu:';
|
||||
StrNSStatusItem_drawStatusBarBackgroundInRect_withHighlight = 'drawStatusBarBackgroundInRect:withHighlight:';
|
||||
|
||||
StrNSStatusItem_view = 'view';
|
||||
StrNSStatusItem_setView = 'setView:';
|
||||
|
||||
{ NSStatusItem }
|
||||
|
||||
class function NSStatusItem.getClass: objc.id;
|
||||
begin
|
||||
Result := objc_getClass(Str_NSStatusItem);
|
||||
Result := objc_getClass(StrNSStatusItem_NSStatusItem);
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setImage(image: NSImage);
|
||||
type
|
||||
setImage_t = procedure (param1: objc.id; param2: SEL;
|
||||
param3: objc.id); cdecl;
|
||||
var
|
||||
vmethod: setImage_t;
|
||||
function NSStatusItem.statusBar: objc.id;
|
||||
begin
|
||||
vmethod := setImage_t(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(Str_setImage)), image.Handle);
|
||||
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_statusBar)), []));
|
||||
end;
|
||||
|
||||
function NSStatusItem.length: Single;
|
||||
begin
|
||||
Result := Single(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_length)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setLength(_length: Single);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_length: Single); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setLength)), _length);
|
||||
end;
|
||||
|
||||
function NSStatusItem.action: SEL;
|
||||
begin
|
||||
Result := SEL(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_action)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setAction(_action: SEL);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_action: SEL); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setAction)), _action);
|
||||
end;
|
||||
|
||||
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4}
|
||||
function NSStatusItem.doubleAction: SEL;
|
||||
begin
|
||||
Result := SEL(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_doubleAction)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setDoubleAction(_action: SEL);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_action: SEL); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setDoubleAction)), _action);
|
||||
end;
|
||||
|
||||
{.$endif}
|
||||
function NSStatusItem.target: objc.id;
|
||||
begin
|
||||
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_target)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setTarget(_target: objc.id);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_target: objc.id); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setTarget)), _target);
|
||||
end;
|
||||
|
||||
function NSStatusItem.title: CFStringRef;
|
||||
begin
|
||||
Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_title)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setTitle(_title: CFStringRef);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_title: CFStringRef); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setTitle)), _title);
|
||||
end;
|
||||
|
||||
function NSStatusItem.attributedTitle: objc.id;
|
||||
begin
|
||||
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_attributedTitle)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setAttributedTitle(_title: objc.id {NSAttributedString});
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_title: objc.id {NSAttributedString}); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setAttributedTitle)), _title);
|
||||
end;
|
||||
|
||||
function NSStatusItem.image: objc.id;
|
||||
begin
|
||||
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_image)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setImage(_image: objc.id {NSImage});
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_image: objc.id {NSImage}); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setImage)), _image);
|
||||
end;
|
||||
|
||||
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3}
|
||||
function NSStatusItem.alternateImage: objc.id;
|
||||
begin
|
||||
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_alternateImage)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setAlternateImage(_image: objc.id {NSImage});
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_image: objc.id {NSImage}); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setAlternateImage)), _image);
|
||||
end;
|
||||
|
||||
{.$endif}
|
||||
function NSStatusItem.menu: objc.id;
|
||||
begin
|
||||
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_menu)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setMenu(_menu: objc.id {NSMenu});
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_menu: objc.id {NSMenu}); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setMenu)), _menu);
|
||||
end;
|
||||
|
||||
function NSStatusItem.isEnabled: LongBool;
|
||||
begin
|
||||
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_isEnabled)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setEnabled(_enabled: LongBool);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_enabled: LongBool); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setEnabled)), _enabled);
|
||||
end;
|
||||
|
||||
function NSStatusItem.toolTip: CFStringRef;
|
||||
begin
|
||||
Result := CFStringRef(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_toolTip)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setToolTip(_toolTip: CFStringRef);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_toolTip: CFStringRef); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setToolTip)), _toolTip);
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setHighlightMode(_highlightMode: LongBool);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_highlightMode: LongBool); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setHighlightMode)), _highlightMode);
|
||||
end;
|
||||
|
||||
function NSStatusItem.highlightMode: LongBool;
|
||||
begin
|
||||
Result := LongBool(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_highlightMode)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.sendActionOn(_mask: Integer);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_mask: Integer); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_sendActionOn)), _mask);
|
||||
end;
|
||||
|
||||
{.$ifdef MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3}
|
||||
procedure NSStatusItem.popUpStatusItemMenu(_menu: objc.id {NSMenu});
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_menu: objc.id {NSMenu}); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_popUpStatusItemMenu)), _menu);
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.drawStatusBarBackgroundInRect_withHighlight(_rect: NSRect; _highlight: LongBool);
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_rect: NSRect; _highlight: LongBool); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_drawStatusBarBackgroundInRect_withHighlight)), _rect, _highlight);
|
||||
end;
|
||||
|
||||
{.$endif}
|
||||
function NSStatusItem.view: objc.id;
|
||||
begin
|
||||
Result := objc.id(objc_msgSend(Handle, sel_registerName(PChar(StrNSStatusItem_view)), []));
|
||||
end;
|
||||
|
||||
procedure NSStatusItem.setView(_view: objc.id {NSView});
|
||||
type
|
||||
TmsgSendWrapper = procedure (param1: objc.id; param2: SEL;_view: objc.id {NSView}); cdecl;
|
||||
var
|
||||
vmethod: TmsgSendWrapper;
|
||||
begin
|
||||
vmethod := TmsgSendWrapper(@objc_msgSend);
|
||||
vmethod(Handle, sel_registerName(PChar(StrNSStatusItem_setView)), _view);
|
||||
end;
|
||||
|
||||
{$endif}
|
||||
|
||||
|
@ -10,8 +10,8 @@ FRAMEWORK="/System/Library/Frameworks/AppKit.framework/Headers"
|
||||
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSGraphicsContext.h > ../appkit/NSGraphicsContext.inc
|
||||
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSImage.h > ../appkit/NSImage.inc
|
||||
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSImageRep.h > ../appkit/NSImageRep.inc
|
||||
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSMenu.h > ../appkit/NSMenu.inc
|
||||
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSMenuItem.h > ../appkit/NSMenuItem.inc
|
||||
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSMenu.h > ../appkit/NSMenu.inc
|
||||
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSMenuItem.h > ../appkit/NSMenuItem.inc
|
||||
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSStatusBar.h > ../appkit/NSStatusBar.inc
|
||||
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSStatusItem.h > ../appkit/NSStatusItem.inc
|
||||
./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSStatusItem.h > ../appkit/NSStatusItem.inc
|
||||
#./objcparser -ini=$DEFAULT_INI -ini=$APPKIT_INI $FRAMEWORK/NSWindow.h > ../appkit/NSWindow.inc
|
||||
|
@ -35,10 +35,12 @@ type
|
||||
function CreateButton(AView: NSView; ATitle: shortstring;
|
||||
AX, AY, AWidth, AHeight: Double;
|
||||
ACallbackName: string; ACallbackClass: NSObject): NSButton;
|
||||
function CreateMenu(): NSMenu;
|
||||
{ Fields }
|
||||
bar: NSStatusBar;
|
||||
item: NSStatusItem;
|
||||
image: NSImage;
|
||||
myMenu: NSMenu;
|
||||
end;
|
||||
|
||||
const
|
||||
@ -112,13 +114,16 @@ begin
|
||||
|
||||
myController.item := NSStatusItem.CreateWithHandle(myController.bar.statusItemWithLength(NSSquareStatusItemLength));
|
||||
myController.item.retain();
|
||||
myController.item.setImage(myController.image);
|
||||
myController.item.setImage(myController.image.Handle);
|
||||
myController.myMenu := CreateMenu();
|
||||
myController.item.setMenu(myController.myMenu.Handle);
|
||||
end;
|
||||
|
||||
class procedure TMyController.doHideStatusitem(_self: objc.id; _cmd: SEL; sender: objc.id); cdecl;
|
||||
begin
|
||||
if myController.item = nil then Exit;
|
||||
|
||||
myController.myMenu.Free;
|
||||
myController.item.Free;
|
||||
myController.item := nil;
|
||||
end;
|
||||
@ -174,5 +179,19 @@ begin
|
||||
AView.addSubview(Result);
|
||||
end;
|
||||
|
||||
function TMyController.CreateMenu(): NSMenu;
|
||||
var
|
||||
Item1: NSMenuItem;
|
||||
EmptyCFString, Item1Text: CFStringRef;
|
||||
begin
|
||||
EmptyCFString := CFStringCreateWithPascalString(nil, '', kCFStringEncodingUTF8);
|
||||
Item1Text := CFStringCreateWithPascalString(nil, 'Item 1', kCFStringEncodingUTF8);
|
||||
|
||||
Result := NSMenu.initWithTitle(EmptyCFString);
|
||||
|
||||
Item1 := NSMenuItem.initWithTitle_action_keyEquivalent(Item1Text, nil, EmptyCFString);
|
||||
Result.addItem(Item1.Handle);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -66,9 +66,11 @@
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="../../appkit/NSStatusItem.inc"/>
|
||||
<CursorPos X="25" Y="109"/>
|
||||
<TopLine Value="105"/>
|
||||
<CursorPos X="15" Y="76"/>
|
||||
<TopLine Value="63"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="../../appkit/AppKit.inc"/>
|
||||
@ -221,7 +223,7 @@
|
||||
<Filename Value="../../appkit/NSStatusBar.inc"/>
|
||||
<CursorPos X="15" Y="73"/>
|
||||
<TopLine Value="69"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit29>
|
||||
@ -247,9 +249,11 @@
|
||||
<Filename Value="controller.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="controller"/>
|
||||
<CursorPos X="37" Y="103"/>
|
||||
<TopLine Value="100"/>
|
||||
<CursorPos X="16" Y="126"/>
|
||||
<TopLine Value="113"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="46"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit33>
|
||||
<Unit34>
|
||||
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSImage.h"/>
|
||||
@ -385,9 +389,9 @@
|
||||
</Unit52>
|
||||
<Unit53>
|
||||
<Filename Value="../../foundation/Foundation.inc"/>
|
||||
<CursorPos X="11" Y="18"/>
|
||||
<CursorPos X="12" Y="127"/>
|
||||
<TopLine Value="120"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit53>
|
||||
@ -426,9 +430,9 @@
|
||||
</Unit58>
|
||||
<Unit59>
|
||||
<Filename Value="../../../../../lazarus/lcl/interfaces/carbon/carbontrayicon.inc"/>
|
||||
<CursorPos X="9" Y="75"/>
|
||||
<TopLine Value="68"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<CursorPos X="18" Y="96"/>
|
||||
<TopLine Value="94"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="12"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit59>
|
||||
@ -437,7 +441,7 @@
|
||||
<UnitName Value="CarbonInt"/>
|
||||
<CursorPos X="53" Y="39"/>
|
||||
<TopLine Value="32"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="12"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit60>
|
||||
@ -499,15 +503,31 @@
|
||||
<SyntaxHighlighter Value="C++"/>
|
||||
</Unit69>
|
||||
</Units>
|
||||
<JumpHistory Count="2" HistoryIndex="1">
|
||||
<JumpHistory Count="6" HistoryIndex="5">
|
||||
<Position1>
|
||||
<Filename Value="../../foundation/Foundation.inc"/>
|
||||
<Caret Line="8" Column="31" TopLine="1"/>
|
||||
<Filename Value="controller.pas"/>
|
||||
<Caret Line="181" Column="5" TopLine="156"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="../../foundation/Foundation.inc"/>
|
||||
<Caret Line="82" Column="31" TopLine="69"/>
|
||||
<Filename Value="controller.pas"/>
|
||||
<Caret Line="116" Column="24" TopLine="108"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="controller.pas"/>
|
||||
<Caret Line="43" Column="20" TopLine="32"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="controller.pas"/>
|
||||
<Caret Line="117" Column="55" TopLine="104"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="controller.pas"/>
|
||||
<Caret Line="119" Column="42" TopLine="99"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="../../../../../lazarus/lcl/interfaces/carbon/carbontrayicon.inc"/>
|
||||
<Caret Line="75" Column="9" TopLine="68"/>
|
||||
</Position6>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
Loading…
Reference in New Issue
Block a user