2012-12-13 09:12:25 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 2012 Birunthan Mohanathas
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RM_COMMON_DIALOG_H_
|
|
|
|
#define RM_COMMON_DIALOG_H_
|
|
|
|
|
|
|
|
#include <Windows.h>
|
|
|
|
#include "ControlTemplate.h"
|
|
|
|
|
2013-05-31 14:18:52 +00:00
|
|
|
// Shared base class for Dialog and Tab.
|
|
|
|
class BaseDialog
|
2012-12-13 09:12:25 +00:00
|
|
|
{
|
2012-12-13 10:11:27 +00:00
|
|
|
public:
|
|
|
|
HWND GetControl(WORD id) { return GetDlgItem(m_Window, id); }
|
|
|
|
|
2012-12-13 09:12:25 +00:00
|
|
|
protected:
|
2013-05-31 14:18:52 +00:00
|
|
|
BaseDialog();
|
|
|
|
virtual ~BaseDialog() {}
|
2012-12-13 09:12:25 +00:00
|
|
|
|
2013-03-18 15:48:30 +00:00
|
|
|
void Show(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless);
|
2012-12-13 09:12:25 +00:00
|
|
|
|
|
|
|
void CreateControls(const ControlTemplate::Control* cts, UINT ctCount, HFONT font, ControlTemplate::GetStringFunc getString);
|
|
|
|
|
|
|
|
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { return FALSE; }
|
|
|
|
|
|
|
|
HWND m_Window;
|
|
|
|
|
|
|
|
private:
|
2013-05-31 14:18:52 +00:00
|
|
|
BaseDialog(const BaseDialog& r);
|
2012-12-13 09:12:25 +00:00
|
|
|
|
|
|
|
static INT_PTR CALLBACK InitialDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
static INT_PTR CALLBACK MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
};
|
|
|
|
|
2013-05-31 14:18:52 +00:00
|
|
|
class Dialog : public BaseDialog
|
2012-12-13 09:12:25 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
HWND GetWindow() { return m_Window; }
|
|
|
|
|
|
|
|
static bool HandleMessage(MSG& msg);
|
|
|
|
|
|
|
|
protected:
|
2013-05-31 14:18:52 +00:00
|
|
|
class Tab : public BaseDialog
|
2012-12-13 09:12:25 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
HWND GetWindow() { return m_Window; }
|
|
|
|
bool IsInitialized() { return m_Initialized; }
|
|
|
|
void Activate();
|
|
|
|
|
|
|
|
virtual void Initialize() {}
|
|
|
|
virtual void Resize(int w, int h) {}
|
|
|
|
|
|
|
|
protected:
|
2013-05-31 14:18:52 +00:00
|
|
|
Tab();
|
|
|
|
virtual ~Tab();
|
2012-12-13 09:12:25 +00:00
|
|
|
|
|
|
|
void CreateTabWindow(short x, short y, short w, short h, HWND owner);
|
|
|
|
|
|
|
|
bool m_Initialized;
|
|
|
|
};
|
|
|
|
|
2013-05-31 14:18:52 +00:00
|
|
|
Dialog();
|
|
|
|
virtual ~Dialog();
|
2012-12-13 09:12:25 +00:00
|
|
|
|
2013-03-18 15:48:30 +00:00
|
|
|
void ShowDialogWindow(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless = true);
|
2012-12-13 09:12:25 +00:00
|
|
|
|
|
|
|
INT_PTR OnActivate(WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
static void SetMenuButton(HWND button);
|
|
|
|
|
|
|
|
HFONT m_Font;
|
|
|
|
HFONT m_FontBold;
|
|
|
|
|
|
|
|
private:
|
2013-05-31 14:18:52 +00:00
|
|
|
Dialog(const Dialog& r);
|
2012-12-13 09:12:25 +00:00
|
|
|
|
|
|
|
static LRESULT CALLBACK MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData);
|
|
|
|
|
|
|
|
static HWND c_ActiveDialogWindow;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|