Skin Installer: Removed default header image

This commit is contained in:
Birunthan Mohanathas 2012-06-24 16:43:51 +03:00
parent 6fa58c2df4
commit 22406cde19
3 changed files with 32 additions and 12 deletions

View File

@ -45,6 +45,7 @@ inline bool IsWin32Build()
*/ */
CDialogInstall::CDialogInstall(HWND wnd, const WCHAR* file) : CDialog(wnd), CDialogInstall::CDialogInstall(HWND wnd, const WCHAR* file) : CDialog(wnd),
m_TabInstall(wnd), m_TabInstall(wnd),
m_HeaderBitmap(),
m_InstallThread(), m_InstallThread(),
m_PackageUnzFile(), m_PackageUnzFile(),
m_PackageFileName(file), m_PackageFileName(file),
@ -165,6 +166,33 @@ INT_PTR CDialogInstall::OnInitDialog(WPARAM wParam, LPARAM lParam)
if (ReadPackage()) if (ReadPackage())
{ {
item = GetDlgItem(m_Window, IDC_INSTALL_HEADER_BITMAP);
if (m_HeaderBitmap)
{
SendMessage(item, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)m_HeaderBitmap);
}
else
{
RECT r;
GetClientRect(item, &r);
ShowWindow(item, SW_HIDE);
int yDiff = r.bottom;
// Move all controls on the main dialog up to "fill" header area.
int controlIds[] = { IDC_INSTALL_TAB, IDC_INSTALL_ADVANCED_BUTTON, IDC_INSTALL_INSTALL_BUTTON, IDCANCEL, 0 };
for (int i = 0; i < _countof(controlIds); ++i)
{
HWND control = controlIds[i] ? GetDlgItem(m_Window, controlIds[i]) : m_TabInstall.GetWindow();
GetWindowRect(control, &r);
MapWindowPoints(NULL, m_Window, (POINT*)&r, sizeof(RECT) / sizeof(POINT));
MoveWindow(control, r.left, r.top - yDiff, r.right - r.left, r.bottom - r.top, TRUE);
}
// Remove blank area at the bottom of the dialog and center it.
GetWindowRect(m_Window, &r);
MoveWindow(m_Window, r.left, r.top + (yDiff / 2), r.right - r.left, r.bottom - r.top - yDiff, TRUE);
}
m_TabInstall.Activate(); m_TabInstall.Activate();
} }
else else
@ -468,9 +496,7 @@ bool CDialogInstall::ReadPackage()
return false; return false;
} }
HBITMAP bitmap = (HBITMAP)LoadImage(NULL, tempFileSz, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); m_HeaderBitmap = (HBITMAP)LoadImage(NULL, tempFileSz, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
HWND header = GetDlgItem(m_Window, IDC_INSTALL_HEADER_BITMAP);
SendMessage(header, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)bitmap);
DeleteFile(tempFileSz); DeleteFile(tempFileSz);
} }

View File

@ -106,6 +106,8 @@ private:
CTabInstall m_TabInstall; CTabInstall m_TabInstall;
HBITMAP m_HeaderBitmap;
HANDLE m_InstallThread; HANDLE m_InstallThread;
std::wstring m_ErrorMessage; std::wstring m_ErrorMessage;

View File

@ -174,8 +174,7 @@ STYLE DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rainmeter Skin Installer" CAPTION "Rainmeter Skin Installer"
FONT 8, "MS Shell Dlg 2" FONT 8, "MS Shell Dlg 2"
{ {
CONTROL IDB_INSTALLHEADER, IDC_INSTALL_HEADER_BITMAP, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 266, 37 CONTROL 0, IDC_INSTALL_HEADER_BITMAP, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 266, 37
CONTROL "", IDC_STATIC, STATIC, SS_ETCHEDHORZ | WS_CHILD | WS_VISIBLE, 0, 37, 270, 1
CONTROL "", IDC_INSTALL_TAB, "SysTabControl32", TCS_TABS | TCS_FIXEDWIDTH, 6, 42, 254, 185 CONTROL "", IDC_INSTALL_TAB, "SysTabControl32", TCS_TABS | TCS_FIXEDWIDTH, 6, 42, 254, 185
PUSHBUTTON "Advanced", IDC_INSTALL_ADVANCED_BUTTON, 6, 231, 70, 14 PUSHBUTTON "Advanced", IDC_INSTALL_ADVANCED_BUTTON, 6, 231, 70, 14
DEFPUSHBUTTON "Install", IDC_INSTALL_INSTALL_BUTTON, 155, 231, 50, 14 DEFPUSHBUTTON "Install", IDC_INSTALL_INSTALL_BUTTON, 155, 231, 50, 14
@ -200,13 +199,6 @@ FONT 8, "MS Shell Dlg 2"
CONTROL "", IDC_INSTALLTAB_PROGRESS, "msctls_progress32", PBS_MARQUEE | NOT WS_VISIBLE | WS_BORDER, 0, 15, 236, 11 CONTROL "", IDC_INSTALLTAB_PROGRESS, "msctls_progress32", PBS_MARQUEE | NOT WS_VISIBLE | WS_BORDER, 0, 15, 236, 11
} }
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_INSTALLHEADER BITMAP "res/Rainstaller.bmp"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Icon // Icon