2015-05-08 16:02:36 +00:00
|
|
|
/*
|
2023-06-23 11:04:32 +00:00
|
|
|
* PROJECT: PAINT for ReactOS
|
|
|
|
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
|
2023-11-23 08:06:32 +00:00
|
|
|
* PURPOSE: The main window
|
2023-06-27 18:22:21 +00:00
|
|
|
* COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
|
2023-11-23 08:06:32 +00:00
|
|
|
* Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
2015-05-08 16:02:36 +00:00
|
|
|
*/
|
|
|
|
|
2017-12-09 12:36:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2015-07-07 10:42:49 +00:00
|
|
|
class CMainWindow : public CWindowImpl<CMainWindow>
|
|
|
|
{
|
|
|
|
public:
|
2023-11-04 10:25:45 +00:00
|
|
|
DECLARE_WND_CLASS_EX(L"MSPaintApp", CS_DBLCLKS, COLOR_BTNFACE)
|
2015-05-08 16:02:36 +00:00
|
|
|
|
2015-07-07 11:44:50 +00:00
|
|
|
BEGIN_MSG_MAP(CMainWindow)
|
2015-07-07 10:42:49 +00:00
|
|
|
MESSAGE_HANDLER(WM_DROPFILES, OnDropFiles)
|
|
|
|
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
|
|
|
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
|
|
|
|
MESSAGE_HANDLER(WM_CLOSE, OnClose)
|
|
|
|
MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup)
|
|
|
|
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
|
|
|
MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
|
|
|
|
MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown)
|
|
|
|
MESSAGE_HANDLER(WM_SYSCOLORCHANGE, OnSysColorChange)
|
|
|
|
MESSAGE_HANDLER(WM_COMMAND, OnCommand)
|
2021-12-27 13:20:22 +00:00
|
|
|
MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel)
|
2015-07-07 10:42:49 +00:00
|
|
|
END_MSG_MAP()
|
|
|
|
|
2023-03-28 13:31:26 +00:00
|
|
|
CMainWindow() : m_hMenu(NULL) { }
|
|
|
|
|
|
|
|
HWND DoCreate();
|
2023-11-04 10:25:45 +00:00
|
|
|
BOOL GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile);
|
|
|
|
BOOL GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile);
|
2023-03-28 13:31:26 +00:00
|
|
|
BOOL ChooseColor(IN OUT COLORREF *prgbColor);
|
2023-06-18 22:51:19 +00:00
|
|
|
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu);
|
2023-06-19 05:13:43 +00:00
|
|
|
BOOL CanUndo() const;
|
|
|
|
BOOL CanRedo() const;
|
2023-06-19 09:59:00 +00:00
|
|
|
BOOL CanPaste() const;
|
2023-03-28 13:31:26 +00:00
|
|
|
|
2023-03-16 22:28:01 +00:00
|
|
|
private:
|
2023-03-28 13:31:26 +00:00
|
|
|
HMENU m_hMenu;
|
|
|
|
|
2015-07-07 10:42:49 +00:00
|
|
|
LRESULT OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnDestroy(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnInitMenuPopup(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnGetMinMaxInfo(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
|
|
|
LRESULT OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
2021-12-27 13:20:22 +00:00
|
|
|
LRESULT OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
2015-07-07 11:02:30 +00:00
|
|
|
|
|
|
|
void alignChildrenToMainWindow();
|
|
|
|
void saveImage(BOOL overwrite);
|
|
|
|
void InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window);
|
2020-04-28 22:44:18 +00:00
|
|
|
BOOL ConfirmSave();
|
2023-03-16 22:28:01 +00:00
|
|
|
void ProcessFileMenu(HMENU hPopupMenu);
|
2015-07-07 10:42:49 +00:00
|
|
|
};
|