Replace RECT CStdWindow::GetSize argument with C4Rect

Günther Brammer 2011-03-13 20:00:03 +01:00
parent d5ab5d31bb
commit 2a1db87698
8 changed files with 37 additions and 28 deletions

View File

@ -439,19 +439,19 @@ namespace C4GUI
{
if (!pDialog)
return; // safety
RECT r;
C4Rect r;
GetSize(&r);
if (pSurface)
{
pSurface->Wdt = r.right;
pSurface->Hgt = r.bottom;
pSurface->Wdt = r.Wdt;
pSurface->Hgt = r.Hgt;
#ifdef USE_GL
pGL->PrepareRendering(pSurface);
glClear(GL_COLOR_BUFFER_BIT);
#endif
}
C4TargetFacet cgo;
cgo.Set(NULL, 0, 0, r.right, r.bottom, 0, 0);
cgo.Set(NULL, 0, 0, r.Wdt, r.Hgt, 0, 0);
pDialog->Draw(cgo);
}

View File

@ -81,7 +81,7 @@ bool C4Viewport::UpdateOutputSize()
{
if (!pWindow) return false;
// Output size
RECT rect;
C4Rect rect;
#ifdef WITH_DEVELOPER_MODE
GtkAllocation allocation;
@ -92,15 +92,15 @@ bool C4Viewport::UpdateOutputSize()
#endif
// Use only size of drawing area without scrollbars
rect.left = allocation.x;
rect.top = allocation.y;
rect.right = rect.left + allocation.width;
rect.bottom = rect.top + allocation.height;
rect.x = allocation.x;
rect.y = allocation.y;
rect.Wdt = allocation.width;
rect.Hgt = allocation.height;
#else
if (!pWindow->GetSize(&rect)) return false;
#endif
OutX=rect.left; OutY=rect.top;
ViewWdt=rect.right-rect.left; ViewHgt=rect.bottom-rect.top;
OutX=rect.x; OutY=rect.y;
ViewWdt=rect.Wdt; ViewHgt=rect.Hgt;
// Scroll bars
ScrollBarsByViewPosition();
// Reset menus

View File

@ -20,6 +20,7 @@
#include <StdWindow.h>
#include <C4Version.h>
#include <C4Application.h>
#include <C4Rect.h>
#import <Appkit/AppKit.h>
#import <ClonkWindowController.h>
@ -102,15 +103,15 @@ void CStdWindow::SetTitle(const char *szToTitle)
[controller.window setTitle:[NSString stringWithUTF8String:szToTitle ? szToTitle : ""]];
}
bool CStdWindow::GetSize(RECT * pRect)
bool CStdWindow::GetSize(C4Rect * pRect)
{
ClonkWindowController* controller = ctrler;
NSView* view = controller.openGLView ? controller.openGLView : controller.window.contentView;
NSRect r = [view frame];
pRect->top = 0;
pRect->left = 0;
pRect->right = r.size.width;
pRect->bottom = r.size.height;
pRect->x = 0;
pRect->y = 0;
pRect->Wdt = r.size.width;
pRect->Hgt = r.size.height;
return true;
}

View File

@ -28,6 +28,7 @@
#include <StdBuf.h>
#include "C4Version.h"
#include <C4Rect.h>
#include <C4Config.h>
/* CStdWindow */
@ -78,10 +79,10 @@ bool CStdWindow::RestorePosition(const char *, const char *, bool) { return true
// Window size is automatically managed by CStdApp's display mode management.
// Just remember the size for others to query.
bool CStdWindow::GetSize(RECT * pRect)
bool CStdWindow::GetSize(C4Rect * pRect)
{
pRect->left = pRect->top = 0;
pRect->right = width, pRect->bottom = height;
pRect->x = pRect->y = 0;
pRect->Wdt = width, pRect->Hgt = height;
return true;
}

View File

@ -226,7 +226,7 @@ CStdWindow::CStdWindow() {}
CStdWindow::~CStdWindow() {}
void CStdWindow::EnumerateMultiSamples(std::vector<int, std::allocator<int> >&) const {}
void CStdWindow::FlashWindow() {}
bool CStdWindow::GetSize(RECT*) {return 0;}
bool CStdWindow::GetSize(C4Rect*) {return 0;}
CStdWindow* CStdWindow::Init(CStdWindow::WindowKind, CStdApp*, char const*, CStdWindow*, bool) {return this;}
bool CStdWindow::ReInit(CStdApp*) {return 0;}
bool CStdWindow::RestorePosition(char const*, char const*, bool) {return 0;}

View File

@ -29,6 +29,7 @@
#include <StdRegistry.h>
#include <C4Config.h>
#include <C4Rect.h>
#ifdef USE_GL
#include <StdGL.h>
#endif
@ -169,9 +170,14 @@ void CStdWindow::SetTitle(const char *szToTitle)
if (hWindow) SetWindowText(hWindow, szToTitle ? szToTitle : "");
}
bool CStdWindow::GetSize(RECT * pRect)
bool CStdWindow::GetSize(C4Rect * pRect)
{
if (!(hWindow && GetClientRect(hWindow,pRect))) return false;
RECT r;
if (!(hWindow && GetClientRect(hWindow,&r))) return false;
pRect->x = r.left;
pRect->y = r.top;
pRect->Wdt = r.right - r.left;
pRect->Hgt = r.bottom - r.top;
return true;
}

View File

@ -318,7 +318,7 @@ public:
bool StorePosition(const char *szWindowName, const char *szSubKey, bool fStoreSize = true);
bool RestorePosition(const char *szWindowName, const char *szSubKey, bool fHidden = false);
bool GetSize(RECT * pRect);
bool GetSize(C4Rect * pRect);
void SetSize(unsigned int cx, unsigned int cy); // resize
void SetTitle(const char * Title);
void FlashWindow();

View File

@ -31,6 +31,7 @@
#include <StdBuf.h>
#include <C4Config.h>
#include <C4Rect.h>
#include "C4Version.h"
#include "c4x.xpm"
@ -490,7 +491,7 @@ bool CStdWindow::RestorePosition(const char *, const char *, bool)
return true;
}
bool CStdWindow::GetSize(RECT * pRect)
bool CStdWindow::GetSize(C4Rect * pRect)
{
Window winDummy;
unsigned int borderDummy;
@ -499,10 +500,10 @@ bool CStdWindow::GetSize(RECT * pRect)
unsigned int depth;
XGetGeometry(dpy, wnd, &winDummy, &x, &y,
&width, &height, &borderDummy, &depth);
pRect->right = width + x;
pRect->bottom = height + y;
pRect->top = y;
pRect->left = x;
pRect->Wdt = width;
pRect->Hgt = height;
pRect->y = y;
pRect->x = x;
return true;
}