From 0bc35fc72661fb099bdffe7dbffa1fc6f873df29 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Thu, 31 Jul 2008 15:23:56 +0000 Subject: [PATCH] Improves Cocoa bindings git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@518 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../coregraphics/CGWindowLevel.inc | 89 ------------------- .../coregraphics/cocoacoregraphics.pas | 59 ------------ bindings/pascocoa/cocoa_pkg.lpk | 16 ++-- bindings/pascocoa/cocoa_pkg.pas | 6 +- .../examples/simplewindow/simplewindow.lpi | 10 ++- .../examples/simplewindow/simplewindow.pas | 2 +- .../examples/statusitem/controller.pas | 2 +- 7 files changed, 18 insertions(+), 166 deletions(-) delete mode 100644 bindings/pascocoa/applicationservices/coregraphics/CGWindowLevel.inc delete mode 100644 bindings/pascocoa/applicationservices/coregraphics/cocoacoregraphics.pas diff --git a/bindings/pascocoa/applicationservices/coregraphics/CGWindowLevel.inc b/bindings/pascocoa/applicationservices/coregraphics/CGWindowLevel.inc deleted file mode 100644 index 17d166d8f..000000000 --- a/bindings/pascocoa/applicationservices/coregraphics/CGWindowLevel.inc +++ /dev/null @@ -1,89 +0,0 @@ -{%MainUnit CoreGraphics.pas} -{ - CGWindowLevel.h - CoreGraphics - - Copyright (c) 2000 Apple Computer, Inc. All rights reserved. - -} - -//#include -//#include - -//CG_EXTERN_C_BEGIN - -{ - * Windows may be assigned to a particular level. When assigned to a level, - * the window is ordered relative to all other windows in that level. - * Windows with a higher level are sorted in front of windows with a lower - * level. - * - * A common set of window levels is defined here for use within higher - * level frameworks. The levels are accessed via a key and function, - * so that levels may be changed or adjusted in future releases without - * breaking binary compatability. - } - -type - CGWindowLevel = LongInt; - CGWindowLevelKey = LongInt; - - CGCommonWindowLevelKey = ( - kCGBaseWindowLevelKey = 0, - kCGMinimumWindowLevelKey, - kCGDesktopWindowLevelKey, - kCGBackstopMenuLevelKey, - kCGNormalWindowLevelKey, - kCGFloatingWindowLevelKey, - kCGTornOffMenuWindowLevelKey, - kCGDockWindowLevelKey, - kCGMainMenuWindowLevelKey, - kCGStatusWindowLevelKey, - kCGModalPanelWindowLevelKey, - kCGPopUpMenuWindowLevelKey, - kCGDraggingWindowLevelKey, - kCGScreenSaverWindowLevelKey, - kCGMaximumWindowLevelKey, - kCGOverlayWindowLevelKey, - kCGHelpWindowLevelKey, - kCGUtilityWindowLevelKey, - kCGDesktopIconWindowLevelKey, - kCGCursorWindowLevelKey, - kCGAssistiveTechHighWindowLevelKey, - kCGNumberOfWindowLevelKeys { Internal bookkeeping; must be last } - ); - -//CGWindowLevel CGWindowLevelForKey( CGWindowLevelKey key ); - -{ number of levels above kCGMaximumWindowLevel reserved for internal use } -const - kCGNumReservedWindowLevels = (16); - -{ Definitions of older constant values as calls } - kCGBaseWindowLevel = Low(LongInt); { LONG_MIN } - kCGMinimumWindowLevel = kCGBaseWindowLevel + 1; //CGWindowLevelForKey(kCGMinimumWindowLevelKey) /* (kCGBaseWindowLevel + 1) */ - kCGDesktopWindowLevel = kCGBaseWindowLevel; //CGWindowLevelForKey(kCGDesktopWindowLevelKey) /* kCGMinimumWindowLevel */ - kCGDesktopIconWindowLevel = kCGBaseWindowLevel + 20; //CGWindowLevelForKey(kCGDesktopIconWindowLevelKey) /* kCGMinimumWindowLevel + 20 */ - kCGBackstopMenuLevel = -20; //CGWindowLevelForKey(kCGBackstopMenuLevelKey) /* -20 */ - kCGNormalWindowLevel = 0; //CGWindowLevelForKey(kCGNormalWindowLevelKey) /* 0 */ - kCGFloatingWindowLevel = 3; //CGWindowLevelForKey(kCGFloatingWindowLevelKey) /* 3 */ - kCGTornOffMenuWindowLevel = 3; //CGWindowLevelForKey(kCGTornOffMenuWindowLevelKey) /* 3 */ - kCGDockWindowLevel = 20; //CGWindowLevelForKey(kCGDockWindowLevelKey) /* 20 */ - kCGMainMenuWindowLevel = 24; //CGWindowLevelForKey(kCGMainMenuWindowLevelKey) /* 24 */ - kCGStatusWindowLevel = 25; //CGWindowLevelForKey(kCGStatusWindowLevelKey) /* 25 */ - kCGModalPanelWindowLevel = 8; //CGWindowLevelForKey(kCGModalPanelWindowLevelKey) /* 8 */ - kCGPopUpMenuWindowLevel = 101; //CGWindowLevelForKey(kCGPopUpMenuWindowLevelKey) { 101 } - kCGDraggingWindowLevel = 500; //CGWindowLevelForKey(kCGDraggingWindowLevelKey) { 500 } - kCGScreenSaverWindowLevel = 1000; //CGWindowLevelForKey(kCGScreenSaverWindowLevelKey) { 1000 } - kCGCursorWindowLevel = 2000; //CGWindowLevelForKey(kCGCursorWindowLevelKey) { 2000 } - kCGOverlayWindowLevel = 102; //CGWindowLevelForKey(kCGOverlayWindowLevelKey) { 102 } - kCGHelpWindowLevel = 102; //CGWindowLevelForKey(kCGHelpWindowLevelKey) { 102 } - kCGUtilityWindowLevel = 19; //CGWindowLevelForKey(kCGUtilityWindowLevelKey) { 19 } - - kCGAssistiveTechHighWindowLevel = 1500; //CGWindowLevelForKey(kCGAssistiveTechHighWindowLevelKey) { 1500 } - - kCGMaximumWindowLevel = High(LongInt) -kCGNumReservedWindowLevels; { LONG_MAX - kCGNumReservedWindowLevels } - - -//CG_EXTERN_C_END - diff --git a/bindings/pascocoa/applicationservices/coregraphics/cocoacoregraphics.pas b/bindings/pascocoa/applicationservices/coregraphics/cocoacoregraphics.pas deleted file mode 100644 index 61dc39a5f..000000000 --- a/bindings/pascocoa/applicationservices/coregraphics/cocoacoregraphics.pas +++ /dev/null @@ -1,59 +0,0 @@ -{ - CoreGraphics - CoreGraphics.h - Copyright (c) 2000 Apple Computer, Inc. - All rights reserved. - - Main CoreGraphics file. Includes all include files from CoreGraphics - - CoreGraphics is located inside the ApplicationServices framework -} -unit CocoaCoreGraphics; - -interface - -{#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include } -{$include CGWindowLevel.inc} - -implementation - -end. - diff --git a/bindings/pascocoa/cocoa_pkg.lpk b/bindings/pascocoa/cocoa_pkg.lpk index 7e778b210..9031ea91f 100644 --- a/bindings/pascocoa/cocoa_pkg.lpk +++ b/bindings/pascocoa/cocoa_pkg.lpk @@ -5,8 +5,8 @@ - - + + @@ -16,23 +16,19 @@ - + - - - - - - + + - + diff --git a/bindings/pascocoa/cocoa_pkg.pas b/bindings/pascocoa/cocoa_pkg.pas index c68dba54d..101ebefa3 100644 --- a/bindings/pascocoa/cocoa_pkg.pas +++ b/bindings/pascocoa/cocoa_pkg.pas @@ -1,5 +1,5 @@ -{ This file was automatically created by Lazarus. Do not edit! -This source is only used to compile and install the package. +{ This file was automatically created by Lazarus. do not edit! + This source is only used to compile and install the package. } unit cocoa_pkg; @@ -7,7 +7,7 @@ unit cocoa_pkg; interface uses - appkit, CocoaCoreGraphics, foundation, objc, LazarusPackageIntf; +appkit, foundation, objc, LazarusPackageIntf; implementation diff --git a/bindings/pascocoa/examples/simplewindow/simplewindow.lpi b/bindings/pascocoa/examples/simplewindow/simplewindow.lpi index 6b760199c..544410247 100644 --- a/bindings/pascocoa/examples/simplewindow/simplewindow.lpi +++ b/bindings/pascocoa/examples/simplewindow/simplewindow.lpi @@ -33,8 +33,8 @@ - - + + @@ -387,7 +387,7 @@ - + @@ -396,6 +396,10 @@ + + + + diff --git a/bindings/pascocoa/examples/simplewindow/simplewindow.pas b/bindings/pascocoa/examples/simplewindow/simplewindow.pas index 9ac91ae06..d68b50ab4 100644 --- a/bindings/pascocoa/examples/simplewindow/simplewindow.pas +++ b/bindings/pascocoa/examples/simplewindow/simplewindow.pas @@ -65,7 +65,7 @@ begin TextField := NSTextField.initWithFrame(TextFieldRect); TextField.setStringValue(CFMessage); MainWindowView := NSView.CreateWithHandle(MainWindow.contentView); - MainWindowView.addSubview(TextField); + MainWindowView.addSubview(TextField.Handle); { Put's the window on the front z-order } diff --git a/bindings/pascocoa/examples/statusitem/controller.pas b/bindings/pascocoa/examples/statusitem/controller.pas index 1ba6414a4..a2288b535 100644 --- a/bindings/pascocoa/examples/statusitem/controller.pas +++ b/bindings/pascocoa/examples/statusitem/controller.pas @@ -168,7 +168,7 @@ begin Result.setBezelStyle(NSRoundedBezelStyle); Result.setAction(sel_registerName(PChar(ACallbackName))); Result.setTarget(ACallbackClass.Handle); - AView.addSubview(Result); + AView.addSubview(Result.Handle); end; function TMyController.CreateMenu(): NSMenu;