📄 abwin.h
字号:
// AbWin.h: interface for the CAbWin class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ABWIN_H__3686B0E7_423E_11D5_8DCF_B53F12C8D33C__INCLUDED_)
#define AFX_ABWIN_H__3686B0E7_423E_11D5_8DCF_B53F12C8D33C__INCLUDED_
#ifndef LPARAM
#include <windef.h>
#endif
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <string>
#include <deque>
#include "AbException.h"
#include "WinRect.h"
#include "WinContainer.h"
//namespace vw{ //VW=Virtual Windowing
class CAbFont;
class CAbWin : public CAbProcClient
{
public:
virtual LRESULT Proc(HWND h,UINT m,WPARAM w,LPARAM l) { return WindowProc(h,m,w,l); }
virtual const char *GetDesc() const { return GetTitle(); }
private:
string m_strModName;
HMENU m_hMenu;
HWND m_hWnd,m_hParWnd;
// WNDCLASSEX m_sWndClass;
ATOM m_atmClass;
CWinRect m_rRect,m_rClient;
HMODULE m_hMod;
HFONT m_hFont;
CAbFont *m_pFont;
HBRUSH m_hBgBrush;
public:
CAbWin(const char *szModName=NULL); //pass the ModuleName,needed for dll's
CAbWin(const CAbWin&);
virtual ~CAbWin();
virtual void Init(CAbWin &c) { Init(c.GetWndHandle());}
virtual void Init(HWND); //Creates the Class
virtual void DeInit();
virtual void Create(); //Creates the Window
virtual void PostCreate(); //Finshes Init->Call after Create
const HWND GetWndHandle() const { return m_hWnd; }
const HWND GetParHandle() const { return m_hParWnd; }
HWND SetParHandle(HWND,bool bInWinToo=true);
HMODULE GetModule() const { return m_hMod; }
void SetFontHandle(HFONT h) { m_hFont=h; }
HFONT GetFontHandle() const { return m_hFont; }
HMENU GetMenuHandle() const { return m_hMenu; }
void SetWindowRect(const CWinRect &r) { m_rRect=r; }
void SetWindowClientRect(const CWinRect &r) { m_rClient=r; }
bool IsWindow() const { return (m_hWnd != 0)?true:false; }
const CWinRect &GetWindowRect() const { return m_rRect;}
const CWinRect &GetClientRect() const { return m_rClient; }
const char *GetModuleName() const { return GetModName(); }
void SetWindowFont(const char *,int);
void SetBgBrush(HBRUSH h);
void SetExWinStyle(DWORD);
void ShowWindow() const { ::ShowWindow(m_hWnd,SW_SHOW); }
void ShowWindowNormal() const { ::ShowWindow(m_hWnd,SW_SHOWNORMAL); }
void HideWindow() const { ::ShowWindow(m_hWnd,SW_HIDE); }
public: //overwriteables-must
// virtual const char *GetTitle() const = 0;
virtual const char *GetTitle() const { return "AbstractWindow";}
virtual const char *GetClassName() const = 0;
//-may
virtual LRESULT WindowProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
virtual HBRUSH GetBgBrush() const { return (HBRUSH)(COLOR_BACKGROUND + 1); }
virtual HCURSOR GetCursor() const { return ::LoadCursor(NULL,IDC_ARROW); }
virtual HICON GetIcon() const { return NULL; }
virtual HICON GetSmallIcon() const { return NULL; }
virtual DWORD GetClassStyle() const { return CS_GLOBALCLASS; }
virtual const char *GetMenuNameString() const { return NULL; }
virtual DWORD GetExWinStyle() const { return (WS_EX_CLIENTEDGE|WS_EX_CONTROLPARENT|WS_EX_NOPARENTNOTIFY);}
virtual DWORD GetWinStyle() const { return (WS_BORDER|WS_CAPTION|WS_THICKFRAME|WS_VISIBLE|WS_POPUP|WS_SYSMENU); }
virtual const CWinRect &GetRect() const { return m_rRect; }
virtual void CalcWindowRectSize();
virtual void Refresh();
WNDPROC *GetWinProc() const;
public://msging
virtual bool OnWMClose();
virtual bool OnWMDestroy();
virtual bool OnWMPaint(HDC) { return false; }
private:
const char *GetModName() const { if(m_strModName != "") return m_strModName.c_str(); else return NULL; }
void LoadMenu();
};
class CWindowProc : public CAbProcData
{
public:
CWindowProc() : CAbProcData() {};
CWindowProc(CAbWin *pC,HWND hWnd) : CAbProcData(pC,hWnd) {};
virtual ~CWindowProc() {}
};
//} //end of namespace
#endif // !defined(AFX_ABWIN_H__3686B0E7_423E_11D5_8DCF_B53F12C8D33C__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -