This commit is contained in:
Igor Pavlov
2014-11-23 00:00:00 +00:00
committed by Kornel Lesiński
parent 83f8ddcc5b
commit f08f4dcc3c
1158 changed files with 76451 additions and 35082 deletions

52
CPP/Windows/Control/Dialog.cpp Executable file → Normal file
View File

@@ -2,11 +2,12 @@
#include "StdAfx.h"
#include "Windows/Control/Dialog.h"
#ifndef _UNICODE
#include "../../Common/StringConvert.h"
#endif
#include "Dialog.h"
extern HINSTANCE g_hInstance;
#ifndef _UNICODE
extern bool g_IsNT;
@@ -99,6 +100,55 @@ bool IsDialogSizeOK(int xSize, int ySize)
ySize / 8 * y <= wy;
}
bool CDialog::GetMargins(int margin, int &x, int &y)
{
x = margin;
y = margin;
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = margin;
rect.bottom = margin;
if (!MapRect(&rect))
return false;
x = rect.right - rect.left;
y = rect.bottom - rect.top;
return true;
}
int CDialog::Units_To_Pixels_X(int units)
{
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = units;
rect.bottom = units;
if (!MapRect(&rect))
return units * 3 / 2;
return rect.right - rect.left;
}
bool CDialog::GetItemSizes(int id, int &x, int &y)
{
RECT rect;
if (!::GetWindowRect(GetItem(id), &rect))
return false;
x = RECT_SIZE_X(rect);
y = RECT_SIZE_Y(rect);
return true;
}
void CDialog::GetClientRectOfItem(int id, RECT &rect)
{
::GetWindowRect(GetItem(id), &rect);
ScreenToClient(&rect);
}
bool CDialog::MoveItem(int id, int x, int y, int width, int height, bool repaint)
{
return BOOLToBool(::MoveWindow(GetItem(id), x, y, width, height, BoolToBOOL(repaint)));
}
void CDialog::NormalizeSize(bool fullNormalize)
{
RECT workRect;