From 7d47def4c94b14a9c5b845b437ed671a03fb851f Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 5 Aug 2017 20:54:02 -0500 Subject: [PATCH] cocoa: CLASS: ; -> : test-foo ( -- ) Foo -> alloc -> init @@ -21,9 +21,9 @@ CLASS: Foo < NSObject { 101.0 } [ "x" get CGRect-w ] unit-test { 102.0 } [ "x" get CGRect-h ] unit-test -CLASS: Bar < NSObject + { } [ Bar [ @@ -39,11 +39,11 @@ CLASS: Bar < NSObject { 102.0 } [ "x" get CGRect-h ] unit-test ! Make sure that we can add methods -CLASS: Bar < NSObject + { 144 } [ Bar [ diff --git a/basis/cocoa/subclassing/subclassing-docs.factor b/basis/cocoa/subclassing/subclassing-docs.factor index 98df640364..45669ff247 100644 --- a/basis/cocoa/subclassing/subclassing-docs.factor +++ b/basis/cocoa/subclassing/subclassing-docs.factor @@ -1,23 +1,23 @@ USING: help.markup help.syntax strings alien hashtables ; IN: cocoa.subclassing -HELP: CLASS: -{ $syntax "CLASS: name < superclass protocols... imeth... ;" } +HELP: " } { $values { "name" "a new class name" } { "superclass" "a superclass name" } { "protocols" "zero or more protocol names" } { "imeth" "instance method definitions using " { $link POSTPONE: METHOD: } } } { $description "Defines a new Objective C class. Instance methods are defined with the " { $link POSTPONE: METHOD: } " parsing word." $nl "This word is preferred to calling " { $link define-objc-class } ", because it creates a class word in the " { $vocab-link "cocoa.classes" } " vocabulary at parse time, allowing code to refer to the class word in the same source file where the class is defined." } ; -{ define-objc-class POSTPONE: CLASS: POSTPONE: METHOD: } related-words +{ define-objc-class POSTPONE: cocoa-protocol SYNTAX: COCOA-PROTOCOL: scan-token suffix! ; -SYNTAX: CLASS: +SYMBOL: ;CLASS> + +SYNTAX: parse-until [ cocoa-protocol? ] partition [ [ name>> ] map ] dip define-objc-class ; : (parse-selector) ( -- ) diff --git a/basis/tools/deploy/test/14/14.factor b/basis/tools/deploy/test/14/14.factor index f8dd0db174..d1872afff3 100644 --- a/basis/tools/deploy/test/14/14.factor +++ b/basis/tools/deploy/test/14/14.factor @@ -6,13 +6,13 @@ kernel math ; FROM: alien.c-types => float ; IN: tools.deploy.test.14 -CLASS: Bar < NSObject +> [ x>> ] [ y>> ] bi + rect size>> [ w>> ] [ h>> ] bi + + ] ; -; +;CLASS> : main ( -- ) Bar -> alloc -> init diff --git a/basis/ui/backend/cocoa/cocoa.factor b/basis/ui/backend/cocoa/cocoa.factor index 3d5635ddd3..08cc6136a5 100644 --- a/basis/ui/backend/cocoa/cocoa.factor +++ b/basis/ui/backend/cocoa/cocoa.factor @@ -195,14 +195,14 @@ M: cocoa-ui-backend system-alert } cleave ] [ 2drop ] if* ; -CLASS: FactorApplicationDelegate < NSObject + : install-app-delegate ( -- ) NSApp FactorApplicationDelegate install-delegate ; diff --git a/basis/ui/backend/cocoa/tools/tools.factor b/basis/ui/backend/cocoa/tools/tools.factor index a514d8c102..c8f3b7ae45 100644 --- a/basis/ui/backend/cocoa/tools/tools.factor +++ b/basis/ui/backend/cocoa/tools/tools.factor @@ -21,7 +21,7 @@ IN: ui.backend.cocoa.tools image-path save-panel [ save-image ] when* ; ! Handle Open events from the Finder -CLASS: FactorWorkspaceApplicationDelegate < FactorApplicationDelegate + : install-app-delegate ( -- ) NSApp FactorWorkspaceApplicationDelegate install-delegate ; @@ -57,7 +57,7 @@ CLASS: FactorWorkspaceApplicationDelegate < FactorApplicationDelegate dup [ quot call( string -- result/f ) ] when [ pboard set-pasteboard-string ] when* ; -CLASS: FactorServiceProvider < NSObject +string) ] with-interactive-vocabs ] do-service ] ; -; +;CLASS> : register-services ( -- ) NSApp diff --git a/basis/ui/backend/cocoa/views/views.factor b/basis/ui/backend/cocoa/views/views.factor index a5b1dd4313..49478dfb32 100644 --- a/basis/ui/backend/cocoa/views/views.factor +++ b/basis/ui/backend/cocoa/views/views.factor @@ -161,7 +161,7 @@ CONSTANT: selector>action H{ selector>action at [ swap world-focus parents-handle-gesture? t ] [ drop f f ] if* ; -CLASS: FactorView < NSOpenGLView + dealloc ] ; -; +;CLASS> : sync-refresh-to-screen ( GLView -- ) -> openGLContext -> CGLContextObj NSOpenGLCPSwapInterval 1 int @@ -400,7 +400,7 @@ CLASS: FactorView < NSOpenGLView : save-position ( world window -- ) -> frame CGRect-top-left 2array >>window-loc drop ; -CLASS: FactorWindowDelegate < NSObject + retina? set-global ] bi ] [ drop ] if ] ; -; +;CLASS> : install-window-delegate ( window -- ) FactorWindowDelegate install-delegate ;