Adds very initial conversions of various classes for NSStatusItem and NSButton support.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@360 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2008-02-24 13:00:13 +00:00
parent 7765a88ee8
commit 2c2496f08c
6 changed files with 105 additions and 78 deletions

View File

@ -10,16 +10,16 @@
{#import <AppKit/AppKitDefines.h>
#import <AppKit/AppKitErrors.h>
#import <AppKit/NSGraphicsContext.h>
#import <AppKit/NSAccessibility.h>
#import <AppKit/NSActionCell.h> }
{.$include NSAlert.inc}
#import <AppKit/NSAccessibility.h>}
{$include NSActionCell.inc}
{$include NSAlert.inc}
//#import <AppKit/NSAppleScriptExtensions.h>
{$include NSApplication.inc}
{#import <AppKit/NSBox.h>
#import <AppKit/NSButton.h>
#import <AppKit/NSButtonCell.h>
#import <AppKit/NSCell.h>
#import <AppKit/NSClipView.h>
//#import <AppKit/NSBox.h>
{$include NSButton.inc}
{$include NSButtonCell.inc}
{$include NSCell.inc}
{#import <AppKit/NSClipView.h>
#import <AppKit/NSControl.h>
#import <AppKit/NSFont.h>
#import <AppKit/NSFontDescriptor.h>
@ -123,10 +123,10 @@
#import <AppKit/NSGraphicsContext.h>
#import <AppKit/NSAffineTransform.h>
#import <AppKit/NSBezierPath.h>
#import <AppKit/NSPICTImageRep.h>
#import <AppKit/NSStatusBar.h>
#import <AppKit/NSStatusItem.h>
#import <AppKit/NSSound.h>
#import <AppKit/NSPICTImageRep.h>}
{$include NSStatusBar.inc}
{$include NSStatusItem.inc}
{#import <AppKit/NSSound.h>
#import <AppKit/NSMovie.h>
#import <AppKit/NSMovieView.h>
#import <AppKit/NSPDFImageRep.h>

View File

@ -1,3 +1,4 @@
{%mainunit appkit.pas}
{
NSAlert.h
Application Kit
@ -5,6 +6,10 @@
All rights reserved.
}
{$ifdef HEADER}
{$ifndef NSALERT_PAS_H}
{$define NSALERT_PAS_H}
//#import <Foundation/NSObject.h>
//#import <AppKit/NSGraphics.h>
//@class NSTextField, NSPanel, NSArray, NSWindow, NSImage, NSButton, NSError;
@ -18,6 +23,23 @@
// NSCriticalAlertStyle = 2
//} NSAlertStyle;
// by default, NSAlert return values are position dependent, with this mapping:
// first (rightmost) button = NSAlertFirstButtonReturn
// second button = NSAlertSecondButtonReturn
// third button = NSAlertThirdButtonReturn
// buttonPosition 3+x = NSAlertThirdButtonReturn + x
const
NSAlertFirstButtonReturn = 1000;
NSAlertSecondButtonReturn = 1001;
NSAlertThirdButtonReturn = 1002;
{$endif}
{$endif}
{$ifdef CLASSES}
{$ifndef NSALERT_PAS_C}
{$define NSALERT_PAS_C}
//@interface NSAlert : NSObject
{
@private
@ -53,7 +75,7 @@
id reserved2;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
{#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
/* Given an NSError, create an NSAlert that can be used to present the error to the user. The error's localized description, recovery suggestion, and recovery options will be used to set the alert's message text, informative text, and button titles, respectively.
*/
@ -80,18 +102,6 @@
// get the buttons, where the rightmost button is at index 0
- (NSArray *)buttons;
// by default, NSAlert return values are position dependent, with this mapping:
// first (rightmost) button = NSAlertFirstButtonReturn
// second button = NSAlertSecondButtonReturn
// third button = NSAlertThirdButtonReturn
// buttonPosition 3+x = NSAlertThirdButtonReturn + x
enum {
NSAlertFirstButtonReturn = 1000,
NSAlertSecondButtonReturn = 1001,
NSAlertThirdButtonReturn = 1002
};
// The following method can be used to customize return values for buttons
// setTag:(int)tag; setting a tag on a button will cause that tag to be the button's return value
// Note that we reserve the use of the tag for this purpose. We also reserve the use of the target and the action
@ -131,4 +141,8 @@ enum {
- (BOOL)alertShowHelp:(NSAlert *)alert;
@end }
#endif
//#endif
{$endif}
{$endif}

View File

@ -1,3 +1,4 @@
{%mainunit appkit.pas}
{
NSApplication.h
Application Kit
@ -106,7 +107,7 @@ APPKIT_EXTERN NSString *NSApplicationDidChangeScreenParametersNotification; }
{ The version of the AppKit framework }
//APPKIT_EXTERN const double NSAppKitVersionNumber;
NSApplication = class(NSObject) //: NSResponder }
NSApplication = class(NSResponder)
public
constructor sharedApplication;

View File

@ -114,7 +114,7 @@ APPKIT_EXTERN NSString *NSWindowDidChangeScreenProfileNotification AVAILABLE_MA
@class NSEvent;
@class NSWindowController; }
NSWindow = class(NSObject) //: NSResponder
NSWindow = class(NSResponder)
public

View File

@ -11,7 +11,7 @@
<IconPath Value="./"/>
<TargetFileExt Value=""/>
<Title Value="simplewindow"/>
<ActiveEditorIndexAtStart Value="2"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@ -28,22 +28,22 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="37">
<Units Count="41">
<Unit0>
<Filename Value="simplewindow.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="simplewindow"/>
<CursorPos X="45" Y="21"/>
<TopLine Value="43"/>
<CursorPos X="48" Y="21"/>
<TopLine Value="12"/>
<EditorIndex Value="0"/>
<UsageCount Value="48"/>
<UsageCount Value="50"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../../appkit/appkit.pas"/>
<UnitName Value="appkit"/>
<CursorPos X="15" Y="21"/>
<TopLine Value="12"/>
<CursorPos X="1" Y="29"/>
<TopLine Value="20"/>
<EditorIndex Value="1"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
@ -62,8 +62,8 @@
</Unit3>
<Unit4>
<Filename Value="../../appkit/AppKit.inc"/>
<CursorPos X="15" Y="92"/>
<TopLine Value="148"/>
<CursorPos X="16" Y="17"/>
<TopLine Value="8"/>
<EditorIndex Value="2"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
@ -115,8 +115,8 @@
</Unit11>
<Unit12>
<Filename Value="../../foundation/NSAutoreleasePool.inc"/>
<CursorPos X="26" Y="15"/>
<TopLine Value="13"/>
<CursorPos X="43" Y="8"/>
<TopLine Value="2"/>
<UsageCount Value="26"/>
</Unit12>
<Unit13>
@ -141,8 +141,8 @@
</Unit15>
<Unit16>
<Filename Value="../../foundation/NSObject.inc"/>
<CursorPos X="24" Y="89"/>
<TopLine Value="87"/>
<CursorPos X="44" Y="152"/>
<TopLine Value="149"/>
<UsageCount Value="21"/>
</Unit16>
<Unit17>
@ -153,9 +153,11 @@
</Unit17>
<Unit18>
<Filename Value="../../appkit/NSApplication.inc"/>
<CursorPos X="44" Y="355"/>
<TopLine Value="352"/>
<CursorPos X="47" Y="370"/>
<TopLine Value="362"/>
<EditorIndex Value="3"/>
<UsageCount Value="18"/>
<Loaded Value="True"/>
</Unit18>
<Unit19>
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSWindow.h"/>
@ -166,11 +168,9 @@
</Unit19>
<Unit20>
<Filename Value="../../appkit/NSWindow.inc"/>
<CursorPos X="1" Y="474"/>
<TopLine Value="463"/>
<EditorIndex Value="3"/>
<CursorPos X="25" Y="464"/>
<TopLine Value="460"/>
<UsageCount Value="27"/>
<Loaded Value="True"/>
</Unit20>
<Unit21>
<Filename Value="../../appkit/NSWindow_impl.inc"/>
@ -272,40 +272,54 @@
<TopLine Value="261"/>
<UsageCount Value="10"/>
</Unit36>
<Unit37>
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSStatusBar.h"/>
<CursorPos X="58" Y="18"/>
<TopLine Value="17"/>
<UsageCount Value="10"/>
<SyntaxHighlighter Value="C++"/>
</Unit37>
<Unit38>
<Filename Value="../../appkit/NSStatusBar.inc"/>
<CursorPos X="1" Y="59"/>
<TopLine Value="47"/>
<EditorIndex Value="4"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit38>
<Unit39>
<Filename Value="../../appkit/NSStatusItem.inc"/>
<CursorPos X="27" Y="50"/>
<TopLine Value="88"/>
<EditorIndex Value="5"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit39>
<Unit40>
<Filename Value="/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSStatusItem.h"/>
<CursorPos X="38" Y="100"/>
<TopLine Value="85"/>
<UsageCount Value="10"/>
<SyntaxHighlighter Value="C++"/>
</Unit40>
</Units>
<JumpHistory Count="8" HistoryIndex="7">
<JumpHistory Count="4" HistoryIndex="3">
<Position1>
<Filename Value="simplewindow.pas"/>
<Caret Line="21" Column="45" TopLine="8"/>
<Filename Value="../../appkit/AppKit.inc"/>
<Caret Line="17" Column="16" TopLine="8"/>
</Position1>
<Position2>
<Filename Value="../../appkit/appkit.pas"/>
<Caret Line="21" Column="14" TopLine="12"/>
<Filename Value="../../appkit/NSApplication.inc"/>
<Caret Line="360" Column="25" TopLine="356"/>
</Position2>
<Position3>
<Filename Value="../../appkit/NSWindow.inc"/>
<Caret Line="4" Column="24" TopLine="1"/>
<Filename Value="../../appkit/NSStatusBar.inc"/>
<Caret Line="46" Column="1" TopLine="30"/>
</Position3>
<Position4>
<Filename Value="../../appkit/appkit.pas"/>
<Caret Line="21" Column="15" TopLine="12"/>
<Filename Value="../../appkit/NSStatusBar.inc"/>
<Caret Line="32" Column="20" TopLine="23"/>
</Position4>
<Position5>
<Filename Value="../../appkit/AppKit.inc"/>
<Caret Line="17" Column="14" TopLine="3"/>
</Position5>
<Position6>
<Filename Value="../../appkit/AppKit.inc"/>
<Caret Line="55" Column="19" TopLine="47"/>
</Position6>
<Position7>
<Filename Value="../../appkit/AppKit.inc"/>
<Caret Line="69" Column="16" TopLine="60"/>
</Position7>
<Position8>
<Filename Value="../../appkit/AppKit.inc"/>
<Caret Line="92" Column="15" TopLine="83"/>
</Position8>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>

View File

@ -1,10 +1,10 @@
{
simpleform.pas
This example shows how to use the objective-c runtime headers to call
initialization and finalization code for an objective-c class (in this case
NSAutoreleasePool), and also shows a message box using minimal AppKit
bindings to demonstrate that this can be used to build Cocoa applications.
This example shows how to use the PasCocoa bindings to create a
NSAutoreleasePool, initialize the application global variable, create
a simple window without contents and attach a close handler to it that
exits the application.
Compilation of this example requires the following options:
-k-framework -kcocoa -k-lobjc
@ -50,8 +50,6 @@ begin
MainWindow.orderFrontRegardless;
// CreateMenu();
{ Enters main message loop }
NSApp.run;