first commit

This commit is contained in:
Greg Wells
2025-05-05 19:29:42 -04:00
commit 406d669de0
284 changed files with 32727 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
/*
*
* Copyright 2020-2021 Apple Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// AppKit/AppKit.hpp
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <Foundation/Foundation.hpp>
#include "AppKitPrivate.hpp"
#include "NSApplication.hpp"
#include "NSRunningApplication.hpp"
#include "NSWindow.hpp"
#include "NSMenu.hpp"
#include "NSMenuItem.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -0,0 +1,158 @@
/*
*
* Copyright 2020-2021 Apple Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// AppKit/AppKitPrivate.hpp
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <objc/runtime.h>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _APPKIT_PRIVATE_CLS( symbol ) ( Private::Class::s_k ## symbol )
#define _APPKIT_PRIVATE_SEL( accessor ) ( Private::Selector::s_k ## accessor )
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#if defined( NS_PRIVATE_IMPLEMENTATION )
#define _APPKIT_PRIVATE_VISIBILITY __attribute__( ( visibility( "default" ) ) )
#define _APPKIT_PRIVATE_IMPORT __attribute__( ( weak_import ) )
#if __OBJC__
#define _APPKIT_PRIVATE_OBJC_LOOKUP_CLASS( symbol ) ( ( __bridge void* ) objc_lookUpClass( # symbol ) )
#else
#define _APPKIT_PRIVATE_OBJC_LOOKUP_CLASS( symbol ) objc_lookUpClass( # symbol )
#endif // __OBJC__
#define _APPKIT_PRIVATE_DEF_CLS( symbol ) void* s_k ## symbol _NS_PRIVATE_VISIBILITY = _NS_PRIVATE_OBJC_LOOKUP_CLASS( symbol );
#define _APPKIT_PRIVATE_DEF_SEL( accessor, symbol ) SEL s_k ## accessor _NS_PRIVATE_VISIBILITY = sel_registerName( symbol );
#define _APPKIT_PRIVATE_DEF_CONST( type, symbol ) _NS_EXTERN type const NS ## symbol _NS_PRIVATE_IMPORT; \
type const NS::symbol = ( nullptr != &NS ## symbol ) ? NS ## symbol : nullptr;
#else
#define _APPKIT_PRIVATE_DEF_CLS( symbol ) extern void* s_k ## symbol;
#define _APPKIT_PRIVATE_DEF_SEL( accessor, symbol ) extern SEL s_k ## accessor;
#define _APPKIT_PRIVATE_DEF_CONST( type, symbol )
#endif // NS_PRIVATE_IMPLEMENTATION
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS::Private::Class {
_APPKIT_PRIVATE_DEF_CLS( NSApplication );
_APPKIT_PRIVATE_DEF_CLS( NSRunningApplication );
_APPKIT_PRIVATE_DEF_CLS( NSView );
_APPKIT_PRIVATE_DEF_CLS( NSWindow );
_APPKIT_PRIVATE_DEF_CLS( NSMenu );
_APPKIT_PRIVATE_DEF_CLS( NSMenuItem );
} // Class
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS::Private::Selector
{
_APPKIT_PRIVATE_DEF_SEL( addItem_,
"addItem:" );
_APPKIT_PRIVATE_DEF_SEL( addItemWithTitle_action_keyEquivalent_,
"addItemWithTitle:action:keyEquivalent:" );
_APPKIT_PRIVATE_DEF_SEL( applicationDidFinishLaunching_,
"applicationDidFinishLaunching:" );
_APPKIT_PRIVATE_DEF_SEL( applicationShouldTerminateAfterLastWindowClosed_,
"applicationShouldTerminateAfterLastWindowClosed:" );
_APPKIT_PRIVATE_DEF_SEL( applicationWillFinishLaunching_,
"applicationWillFinishLaunching:" );
_APPKIT_PRIVATE_DEF_SEL( close,
"close" );
_APPKIT_PRIVATE_DEF_SEL( currentApplication,
"currentApplication" );
_APPKIT_PRIVATE_DEF_SEL( keyEquivalentModifierMask,
"keyEquivalentModifierMask" );
_APPKIT_PRIVATE_DEF_SEL( localizedName,
"localizedName" );
_APPKIT_PRIVATE_DEF_SEL( sharedApplication,
"sharedApplication" );
_APPKIT_PRIVATE_DEF_SEL( setDelegate_,
"setDelegate:" );
_APPKIT_PRIVATE_DEF_SEL( setActivationPolicy_,
"setActivationPolicy:" );
_APPKIT_PRIVATE_DEF_SEL( activateIgnoringOtherApps_,
"activateIgnoringOtherApps:" );
_APPKIT_PRIVATE_DEF_SEL( run,
"run" );
_APPKIT_PRIVATE_DEF_SEL( terminate_,
"terminate:" );
_APPKIT_PRIVATE_DEF_SEL( initWithContentRect_styleMask_backing_defer_,
"initWithContentRect:styleMask:backing:defer:" );
_APPKIT_PRIVATE_DEF_SEL( initWithFrame_,
"initWithFrame:" );
_APPKIT_PRIVATE_DEF_SEL( initWithTitle_,
"initWithTitle:" );
_APPKIT_PRIVATE_DEF_SEL( setContentView_,
"setContentView:" );
_APPKIT_PRIVATE_DEF_SEL( makeKeyAndOrderFront_,
"makeKeyAndOrderFront:" );
_APPKIT_PRIVATE_DEF_SEL( setKeyEquivalentModifierMask_,
"setKeyEquivalentModifierMask:" );
_APPKIT_PRIVATE_DEF_SEL( setMainMenu_,
"setMainMenu:" );
_APPKIT_PRIVATE_DEF_SEL( setSubmenu_,
"setSubmenu:" );
_APPKIT_PRIVATE_DEF_SEL( setTitle_,
"setTitle:" );
_APPKIT_PRIVATE_DEF_SEL( windows,
"windows" );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -0,0 +1,159 @@
/*
*
* Copyright 2020-2021 Apple Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// AppKit/NSApplication.hpp
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <Foundation/Foundation.hpp>
#include "AppKitPrivate.hpp"
namespace NS
{
_NS_OPTIONS( NS::UInteger, WindowStyleMask )
{
WindowStyleMaskBorderless = 0,
WindowStyleMaskTitled = ( 1 << 0 ),
WindowStyleMaskClosable = ( 1 << 1 ),
WindowStyleMaskMiniaturizable = ( 1 << 2 ),
WindowStyleMaskResizable = ( 1 << 3 ),
WindowStyleMaskTexturedBackground = ( 1 << 8 ),
WindowStyleMaskUnifiedTitleAndToolbar = ( 1 << 12 ),
WindowStyleMaskFullScreen = ( 1 << 14 ),
WindowStyleMaskFullSizeContentView = ( 1 << 15 ),
WindowStyleMaskUtilityWindow = ( 1 << 4 ),
WindowStyleMaskDocModalWindow = ( 1 << 6 ),
WindowStyleMaskNonactivatingPanel = ( 1 << 7 ),
WindowStyleMaskHUDWindow = ( 1 << 13 )
};
_NS_ENUM( NS::UInteger, BackingStoreType )
{
BackingStoreRetained = 0,
BackingStoreNonretained = 1,
BackingStoreBuffered = 2
};
_NS_ENUM( NS::UInteger, ActivationPolicy )
{
ActivationPolicyRegular,
ActivationPolicyAccessory,
ActivationPolicyProhibited
};
class ApplicationDelegate
{
public:
virtual ~ApplicationDelegate() { }
virtual void applicationWillFinishLaunching( Notification* pNotification ) { }
virtual void applicationDidFinishLaunching( Notification* pNotification ) { }
virtual bool applicationShouldTerminateAfterLastWindowClosed( class Application* pSender ) { return false; }
};
class Application : public NS::Referencing< Application >
{
public:
static Application* sharedApplication();
void setDelegate( const ApplicationDelegate* pDelegate );
bool setActivationPolicy( ActivationPolicy activationPolicy );
void activateIgnoringOtherApps( bool ignoreOtherApps );
void setMainMenu( const class Menu* pMenu );
NS::Array* windows() const;
void run();
void terminate( const Object* pSender );
};
}
_NS_INLINE NS::Application* NS::Application::sharedApplication()
{
return Object::sendMessage< Application* >( _APPKIT_PRIVATE_CLS( NSApplication ), _APPKIT_PRIVATE_SEL( sharedApplication ) );
}
_NS_INLINE void NS::Application::setDelegate( const ApplicationDelegate* pAppDelegate )
{
// TODO: Use a more suitable Object instead of NS::Value?
// NOTE: this pWrapper is only held with a weak reference
NS::Value* pWrapper = NS::Value::value( pAppDelegate );
typedef void (*DispatchFunction)( NS::Value*, SEL, void* );
DispatchFunction willFinishLaunching = []( Value* pSelf, SEL, void* pNotification ){
auto pDel = reinterpret_cast< NS::ApplicationDelegate* >( pSelf->pointerValue() );
pDel->applicationWillFinishLaunching( (NS::Notification *)pNotification );
};
DispatchFunction didFinishLaunching = []( Value* pSelf, SEL, void* pNotification ){
auto pDel = reinterpret_cast< NS::ApplicationDelegate* >( pSelf->pointerValue() );
pDel->applicationDidFinishLaunching( (NS::Notification *)pNotification );
};
DispatchFunction shouldTerminateAfterLastWindowClosed = []( Value* pSelf, SEL, void* pApplication ){
auto pDel = reinterpret_cast< NS::ApplicationDelegate* >( pSelf->pointerValue() );
pDel->applicationShouldTerminateAfterLastWindowClosed( (NS::Application *)pApplication );
};
class_addMethod( (Class)_NS_PRIVATE_CLS( NSValue ), _APPKIT_PRIVATE_SEL( applicationWillFinishLaunching_ ), (IMP)willFinishLaunching, "v@:@" );
class_addMethod( (Class)_NS_PRIVATE_CLS( NSValue ), _APPKIT_PRIVATE_SEL( applicationDidFinishLaunching_ ), (IMP)didFinishLaunching, "v@:@" );
class_addMethod( (Class)_NS_PRIVATE_CLS( NSValue ), _APPKIT_PRIVATE_SEL( applicationShouldTerminateAfterLastWindowClosed_), (IMP)shouldTerminateAfterLastWindowClosed, "B@:@" );
Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( setDelegate_ ), pWrapper );
}
_NS_INLINE bool NS::Application::setActivationPolicy( ActivationPolicy activationPolicy )
{
return NS::Object::sendMessage< bool >( this, _APPKIT_PRIVATE_SEL( setActivationPolicy_ ), activationPolicy );
}
_NS_INLINE void NS::Application::activateIgnoringOtherApps( bool ignoreOtherApps )
{
Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( activateIgnoringOtherApps_ ), (ignoreOtherApps ? YES : NO) );
}
_NS_INLINE void NS::Application::setMainMenu( const class Menu* pMenu )
{
Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( setMainMenu_ ), pMenu );
}
_NS_INLINE NS::Array* NS::Application::windows() const
{
return Object::sendMessage< NS::Array* >( this, _APPKIT_PRIVATE_SEL( windows ) );
}
_NS_INLINE void NS::Application::run()
{
Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( run ) );
}
_NS_INLINE void NS::Application::terminate( const Object* pSender )
{
Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( terminate_ ), pSender );
}

View File

@@ -0,0 +1,72 @@
/*
*
* Copyright 2020-2021 Apple Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// AppKit/NSMenu.hpp
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <Foundation/NSPrivate.hpp>
#include "AppKitPrivate.hpp"
namespace NS
{
class MenuItem;
class Menu : public Referencing< Menu >
{
public:
static Menu* alloc();
Menu* init();
Menu* init( const String* pTitle );
MenuItem* addItem( const String* pTitle, SEL pSelector, const String* pKeyEquivalent );
void addItem( const MenuItem* pItem );
};
}
_NS_INLINE NS::Menu* NS::Menu::alloc()
{
return Object::alloc< Menu >( _NS_PRIVATE_CLS( NSMenu ) );
}
_NS_INLINE NS::Menu* NS::Menu::init()
{
return Object::sendMessage< Menu* >( this, _NS_PRIVATE_SEL( init ) );
}
_NS_INLINE NS::Menu* NS::Menu::init( const String* pTitle )
{
return Object::sendMessage< Menu* >( this, _NS_PRIVATE_SEL( initWithTitle_ ), pTitle );
}
_NS_INLINE NS::MenuItem* NS::Menu::addItem( const String* pTitle, SEL pSelector, const String* pKeyEquivalent )
{
return Object::sendMessage< MenuItem* >( this, _NS_PRIVATE_SEL( addItemWithTitle_action_keyEquivalent_ ), pTitle, pSelector, pKeyEquivalent );
}
_NS_INLINE void NS::Menu::addItem( const MenuItem* pItem )
{
Object::sendMessage< void >( this, _NS_PRIVATE_SEL( addItem_ ), pItem );
}

View File

@@ -0,0 +1,112 @@
/*
*
* Copyright 2020-2021 Apple Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// AppKit/NSMenuItem.hpp
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <Foundation/NSPrivate.hpp>
#include "AppKitPrivate.hpp"
#include <string>
namespace NS
{
_NS_OPTIONS( NS::UInteger, KeyEquivalentModifierMask )
{
EventModifierFlagCapsLock = 1 << 16, // Set if Caps Lock key is pressed.
EventModifierFlagShift = 1 << 17, // Set if Shift key is pressed.
EventModifierFlagControl = 1 << 18, // Set if Control key is pressed.
EventModifierFlagOption = 1 << 19, // Set if Option or Alternate key is pressed.
EventModifierFlagCommand = 1 << 20, // Set if Command key is pressed.
EventModifierFlagNumericPad = 1 << 21, // Set if any key in the numeric keypad is pressed.
EventModifierFlagHelp = 1 << 22, // Set if the Help key is pressed.
EventModifierFlagFunction = 1 << 23, // Set if any function key is pressed.
// Used to retrieve only the device-independent modifier flags, allowing applications to mask off the device-dependent modifier flags, including event coalescing information.
EventModifierFlagDeviceIndependentFlagsMask = 0xffff0000UL
};
typedef void (*MenuItemCallback)( void* unused, SEL name, const NS::Object* pSender );
class MenuItem : public NS::Referencing< MenuItem >
{
public:
static SEL registerActionCallback( const char* name, MenuItemCallback callback );
static MenuItem* alloc();
MenuItem* init();
void setKeyEquivalentModifierMask( NS::KeyEquivalentModifierMask modifierMask );
NS::KeyEquivalentModifierMask KeyEquivalentModifierMask() const;
void setSubmenu( const class Menu* pSubmenu );
};
}
_NS_INLINE SEL NS::MenuItem::registerActionCallback( const char* name, NS::MenuItemCallback callback )
{
auto siz = strlen( name );
SEL sel;
if ( ( siz > 0 ) && ( name[ siz - 1 ] != ':' ) )
{
char* colName = (char *)alloca( siz + 2 );
memcpy( colName, name, siz );
colName[ siz ] = ':';
colName[ siz + 1 ] = '\0';
sel = sel_registerName( colName );
}
else
{
sel = sel_registerName( name );
}
if ( callback )
{
class_addMethod( (Class)_NS_PRIVATE_CLS( NSObject ), sel, (IMP)callback, "v@:@" );
}
return sel;
}
_NS_INLINE NS::MenuItem* NS::MenuItem::alloc()
{
return Object::alloc< NS::MenuItem >( _NS_PRIVATE_CLS( NSMenuItem ) );
}
_NS_INLINE NS::MenuItem* NS::MenuItem::init()
{
return Object::sendMessage< NS::MenuItem* >( this, _NS_PRIVATE_SEL( init ) );
}
_NS_INLINE void NS::MenuItem::setKeyEquivalentModifierMask( NS::KeyEquivalentModifierMask modifierMask )
{
return Object::sendMessage< void >( this, _NS_PRIVATE_SEL( setKeyEquivalentModifierMask_ ), modifierMask );
}
_NS_INLINE NS::KeyEquivalentModifierMask NS::MenuItem::KeyEquivalentModifierMask() const
{
return Object::sendMessage< NS::KeyEquivalentModifierMask >( this, _NS_PRIVATE_SEL( keyEquivalentModifierMask ) );
}
_NS_INLINE void NS::MenuItem::setSubmenu( const class NS::Menu* pSubmenu )
{
Object::sendMessage< void >( this, _NS_PRIVATE_SEL( setSubmenu_ ), pSubmenu );
}

View File

@@ -0,0 +1,51 @@
/*
*
* Copyright 2020-2021 Apple Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// AppKit/NSRunningApplication.hpp
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include <Foundation/NSObject.hpp>
#include <Foundation/NSPrivate.hpp>
#include "AppKitPrivate.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace NS
{
class RunningApplication : NS::Referencing< RunningApplication >
{
public:
static RunningApplication* currentApplication();
String* localizedName() const;
};
}
_NS_INLINE NS::RunningApplication* NS::RunningApplication::currentApplication()
{
return Object::sendMessage< NS::RunningApplication* >( _APPKIT_PRIVATE_CLS( NSRunningApplication ), _APPKIT_PRIVATE_SEL( currentApplication ) );
}
_NS_INLINE NS::String* NS::RunningApplication::localizedName() const
{
return Object::sendMessage< NS::String* >( this, _APPKIT_PRIVATE_SEL( localizedName ) );
}

View File

@@ -0,0 +1,45 @@
/*
*
* Copyright 2020-2021 Apple Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// AppKit/NSView.hpp
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "AppKitPrivate.hpp"
#include <Foundation/NSObject.hpp>
#include <CoreGraphics/CGGeometry.h>
namespace NS
{
class View : public NS::Referencing< View >
{
public:
View* init( CGRect frame );
};
}
_NS_INLINE NS::View* NS::View::init( CGRect frame )
{
return Object::sendMessage< View* >( _APPKIT_PRIVATE_CLS( NSView ), _APPKIT_PRIVATE_SEL( initWithFrame_ ), frame );
}

View File

@@ -0,0 +1,81 @@
/*
*
* Copyright 2020-2021 Apple Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// AppKit/NSWindow.hpp
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "AppKitPrivate.hpp"
#include "NSView.hpp"
#include <Foundation/NSObject.hpp>
#include <CoreGraphics/CGGeometry.h>
namespace NS
{
class Window : public Referencing< Window >
{
public:
static Window* alloc();
Window* init( CGRect contentRect, WindowStyleMask styleMask, BackingStoreType backing, bool defer );
void setContentView( const View* pContentView );
void makeKeyAndOrderFront( const Object* pSender );
void setTitle( const String* pTitle );
void close();
};
}
_NS_INLINE NS::Window* NS::Window::alloc()
{
return Object::sendMessage< Window* >( _APPKIT_PRIVATE_CLS( NSWindow ), _NS_PRIVATE_SEL( alloc ) );
}
_NS_INLINE NS::Window* NS::Window::init( CGRect contentRect, WindowStyleMask styleMask, BackingStoreType backing, bool defer )
{
return Object::sendMessage< Window* >( this, _APPKIT_PRIVATE_SEL( initWithContentRect_styleMask_backing_defer_ ), contentRect, styleMask, backing, defer );
}
_NS_INLINE void NS::Window::setContentView( const NS::View* pContentView )
{
Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( setContentView_ ), pContentView );
}
_NS_INLINE void NS::Window::makeKeyAndOrderFront( const Object* pSender )
{
Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( makeKeyAndOrderFront_ ), pSender );
}
_NS_INLINE void NS::Window::setTitle( const String* pTitle )
{
Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( setTitle_), pTitle );
}
_NS_INLINE void NS::Window::close()
{
Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( close ) );
}