Move window size fields to OSXWindow

This commit is contained in:
David Capello 2015-10-06 11:18:21 -03:00
parent 580c900fb2
commit 9e44818cd8
3 changed files with 20 additions and 4 deletions

View File

@ -14,6 +14,8 @@
#include <stdio.h>
#include "gfx/size.h"
class CloseDelegate {
public:
virtual ~CloseDelegate() { }
@ -23,11 +25,15 @@ public:
@interface OSXWindow : NSWindow
{
CloseDelegate* closeDelegate;
gfx::Size clientSize;
gfx::Size restoredSize;
}
- (OSXWindow*)init;
- (void)dealloc;
- (CloseDelegate*)closeDelegate;
- (void)setCloseDelegate:(CloseDelegate*)aDelegate;
- (gfx::Size)clientSize;
- (gfx::Size)restoredSize;
@end
#endif

View File

@ -78,6 +78,8 @@
closeDelegate = nullptr;
NSRect rect = NSMakeRect(0, 0, 640, 480);
clientSize.w = restoredSize.w = rect.size.width;
clientSize.h = restoredSize.h = rect.size.height;
OSXWindowDelegate* windowDelegate = [[OSXWindowDelegate new] autorelease];
[windowDelegate setEventQueue:she::instance()->eventQueue()];
@ -113,4 +115,14 @@
closeDelegate = aDelegate;
}
- (gfx::Size)clientSize
{
return clientSize;
}
- (gfx::Size)restoredSize
{
return restoredSize;
}
@end

View File

@ -21,8 +21,6 @@ public:
bool closing;
int scale;
OSXWindow* window;
gfx::Size clientSize;
gfx::Size restoredSize;
Impl() {
closing = false;
@ -87,12 +85,12 @@ bool SkiaWindow::isMaximized() const
gfx::Size SkiaWindow::clientSize() const
{
return m_impl->clientSize;
return m_impl->window.clientSize;
}
gfx::Size SkiaWindow::restoredSize() const
{
return m_impl->restoredSize;
return m_impl->window.restoredSize;
}
void SkiaWindow::setTitle(const std::string& title)