/ include / AppKit / NSWindow.hpp
NSWindow.hpp
 1  /*
 2   *
 3   * Copyright 2020-2021 Apple Inc.
 4   *
 5   * Licensed under the Apache License, Version 2.0 (the "License");
 6   * you may not use this file except in compliance with the License.
 7   * You may obtain a copy of the License at
 8   *
 9   *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
19  //
20  // AppKit/NSWindow.hpp
21  //
22  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
23  
24  #pragma once
25  
26  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
27  
28  #include "AppKitPrivate.hpp"
29  #include "NSView.hpp"
30  #include <Foundation/NSObject.hpp>
31  
32  #include <CoreGraphics/CGGeometry.h>
33  
34  
35  namespace NS
36  {
37  	class Window : public Referencing< Window >
38  	{
39  		public:
40  			static Window*		alloc();
41  			Window*				init( CGRect contentRect, WindowStyleMask styleMask, BackingStoreType backing, bool defer );
42  
43  			void				setContentView( const View* pContentView );
44  			void				makeKeyAndOrderFront( const Object* pSender );
45  			void				setTitle( const String* pTitle );
46  
47  			void				close();
48  	};
49  
50  }
51  
52  
53  _NS_INLINE NS::Window* NS::Window::alloc()
54  {
55  	return Object::sendMessage< Window* >( _APPKIT_PRIVATE_CLS( NSWindow ), _NS_PRIVATE_SEL( alloc ) );
56  }
57  
58  _NS_INLINE NS::Window* NS::Window::init( CGRect contentRect, WindowStyleMask styleMask, BackingStoreType backing, bool defer )
59  {
60  	return Object::sendMessage< Window* >( this, _APPKIT_PRIVATE_SEL( initWithContentRect_styleMask_backing_defer_ ), contentRect, styleMask, backing, defer );
61  }
62  
63  _NS_INLINE void NS::Window::setContentView( const NS::View* pContentView )
64  {
65  	Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( setContentView_ ), pContentView );
66  }
67  
68  _NS_INLINE void NS::Window::makeKeyAndOrderFront( const Object* pSender )
69  {
70  	Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( makeKeyAndOrderFront_ ), pSender );
71  }
72  
73  _NS_INLINE void NS::Window::setTitle( const String* pTitle )
74  {
75  	Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( setTitle_), pTitle );
76  }
77  
78  _NS_INLINE void NS::Window::close()
79  {
80  	Object::sendMessage< void >( this, _APPKIT_PRIVATE_SEL( close ) );
81  }