📄 afxpriv.h
字号:
afx_msg void OnZoomOut();
afx_msg void OnUpdateNumPageChange(CCmdUI* pCmdUI);
afx_msg void OnUpdateNextPage(CCmdUI* pCmdUI);
afx_msg void OnUpdatePrevPage(CCmdUI* pCmdUI);
afx_msg void OnUpdateZoomIn(CCmdUI* pCmdUI);
afx_msg void OnUpdateZoomOut(CCmdUI* pCmdUI);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
//}}AFX_MSG
void DoZoom(UINT nPage, CPoint point);
void SetScaledSize(UINT nPage);
CSize CalcPageDisplaySize();
CPrintPreviewState* m_pPreviewState; // State to restore
CDialogBar* m_pToolBar; // Toolbar for preview
struct PAGE_INFO
{
PAGE_INFO();
CRect rectScreen; // screen rect (screen device units)
CSize sizeUnscaled; // unscaled screen rect (screen device units)
CSize sizeScaleRatio; // scale ratio (cx/cy)
CSize sizeZoomOutRatio; // scale ratio when zoomed out (cx/cy)
};
PAGE_INFO* m_pPageInfo; // Array of page info structures
PAGE_INFO m_pageInfoArray[2]; // Embedded array for the default implementation
BOOL m_bPageNumDisplayed;// Flags whether or not page number has yet
// been displayed on status line
UINT m_nZoomOutPages; // number of pages when zoomed out
UINT m_nZoomState;
UINT m_nMaxPages; // for sanity checks
UINT m_nCurrentPage;
UINT m_nPages;
int m_nSecondPageOffset; // used to shift second page position
HCURSOR m_hMagnifyCursor;
CSize m_sizePrinterPPI; // printer pixels per inch
CPoint m_ptCenterPoint;
CPrintInfo* m_pPreviewInfo;
DECLARE_MESSAGE_MAP()
friend class CView;
friend BOOL CALLBACK _AfxPreviewCloseProc(CFrameWnd* pFrameWnd);
};
// Zoom States
#define ZOOM_OUT 0
#define ZOOM_MIDDLE 1
#define ZOOM_IN 2
/////////////////////////////////////////////////////////////////////////////
// mirroring support
//WINBUG: some mirroring stuff will be in wingdi.h someday
#ifndef LAYOUT_RTL
#define LAYOUT_LTR 0x00000000
#define LAYOUT_RTL 0x00000001
#define NOMIRRORBITMAP 0x80000000
#endif
//WINBUG: some mirroring stuff will be in winuser.h someday
#ifndef WS_EX_LAYOUTRTL
#define WS_EX_LAYOUTRTL 0x00400000L
#endif
/////////////////////////////////////////////////////////////////////////////
// toolbar docking support
class CDockContext
{
public:
// Construction
CDockContext(CControlBar* pBar);
// Attributes
CPoint m_ptLast; // last mouse position during drag
CRect m_rectLast;
CSize m_sizeLast;
BOOL m_bDitherLast;
// Rectangles used during dragging or resizing
CRect m_rectDragHorz;
CRect m_rectDragVert;
CRect m_rectFrameDragHorz;
CRect m_rectFrameDragVert;
CControlBar* m_pBar; // the toolbar that created this context
CFrameWnd* m_pDockSite; // the controlling frame of the CControlBar
DWORD m_dwDockStyle; // allowable dock styles for bar
DWORD m_dwOverDockStyle; // style of dock that rect is over
DWORD m_dwStyle; // style of control bar
BOOL m_bFlip; // if shift key is down
BOOL m_bForceFrame; // if ctrl key is down
CDC* m_pDC; // where to draw during drag
BOOL m_bDragging;
int m_nHitTest;
UINT m_uMRUDockID;
CRect m_rectMRUDockPos;
DWORD m_dwMRUFloatStyle;
CPoint m_ptMRUFloatPos;
// Drag Operations
virtual void StartDrag(CPoint pt);
void Move(CPoint pt); // called when mouse has moved
void EndDrag(); // drop
void OnKey(int nChar, BOOL bDown);
// Resize Operations
virtual void StartResize(int nHitTest, CPoint pt);
void Stretch(CPoint pt);
void EndResize();
// Double Click Operations
virtual void ToggleDocking();
// Operations
void InitLoop();
void CancelLoop();
// Implementation
public:
~CDockContext();
BOOL Track();
void DrawFocusRect(BOOL bRemoveRect = FALSE);
// draws the correct outline
void UpdateState(BOOL* pFlag, BOOL bNewValue);
DWORD CanDock();
CDockBar* GetDockBar(DWORD dwOverDockStyle);
};
/////////////////////////////////////////////////////////////////////////////
// CControlBarInfo - used for docking serialization
class CControlBarInfo
{
public:
// Implementation
CControlBarInfo();
// Attributes
UINT m_nBarID; // ID of this bar
BOOL m_bVisible; // visibility of this bar
BOOL m_bFloating; // whether floating or not
BOOL m_bHorz; // orientation of floating dockbar
BOOL m_bDockBar; // TRUE if a dockbar
CPoint m_pointPos; // topleft point of window
UINT m_nMRUWidth; // MRUWidth for Dynamic Toolbars
BOOL m_bDocking; // TRUE if this bar has a DockContext
UINT m_uMRUDockID; // most recent docked dockbar
CRect m_rectMRUDockPos; // most recent docked position
DWORD m_dwMRUFloatStyle; // most recent floating orientation
CPoint m_ptMRUFloatPos; // most recent floating position
CPtrArray m_arrBarID; // bar IDs for bars contained within this one
CControlBar* m_pBar; // bar which this refers to (transient)
void Serialize(CArchive& ar, CDockState* pDockState);
BOOL LoadState(LPCTSTR lpszProfileName, int nIndex, CDockState* pDockState);
BOOL SaveState(LPCTSTR lpszProfileName, int nIndex);
};
/////////////////////////////////////////////////////////////////////////////
// CDockBar - used for docking
class CDockBar : public CControlBar
{
DECLARE_DYNAMIC(CDockBar)
// Construction
public:
CDockBar(BOOL bFloating = FALSE); // TRUE if attached to CMiniDockFrameWnd
BOOL Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID);
// Attributes
BOOL m_bFloating;
virtual BOOL IsDockBar() const;
int GetDockedCount() const;
virtual int GetDockedVisibleCount() const;
// Operations
void DockControlBar(CControlBar* pBar, LPCRECT lpRect = NULL);
void ReDockControlBar(CControlBar* pBar, LPCRECT lpRect = NULL);
BOOL RemoveControlBar(CControlBar*, int nPosExclude = -1, int nAddPlaceHolder = 0);
void RemovePlaceHolder(CControlBar* pBar);
// Implementation
public:
virtual ~CDockBar();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
virtual void DoPaint(CDC* pDC);
// public implementation helpers
void GetBarInfo(CControlBarInfo* pInfo);
void SetBarInfo(CControlBarInfo* pInfo, CFrameWnd* pFrameWnd);
int FindBar(CControlBar* pBar, int nPosExclude = -1);
void ShowAll(BOOL bShow);
CPtrArray m_arrBars; // each element is a CControlBar
protected:
BOOL m_bLayoutQuery;
CRect m_rectLayout;
CControlBar* GetDockedControlBar(int nPos) const;
// implementation helpers
int Insert(CControlBar* pBar, CRect rect, CPoint ptMid);
virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
//{{AFX_MSG(CDockBar)
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
afx_msg void OnNcPaint();
afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
afx_msg void OnPaint();
afx_msg LRESULT OnSizeParent(WPARAM, LPARAM);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
friend class CMiniDockFrameWnd;
};
class CMiniDockFrameWnd : public CMiniFrameWnd
{
DECLARE_DYNCREATE(CMiniDockFrameWnd)
public:
// Construction
CMiniDockFrameWnd();
virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
// Operations
virtual void RecalcLayout(BOOL bNotify = TRUE);
// Implementation
public:
CDockBar m_wndDockBar;
//{{AFX_MSG(CMiniFrameWnd)
afx_msg void OnClose();
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
//}}AFX_MSG
afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// COleCntrFrameWnd
class COleIPFrameWnd;
class COleCntrFrameWnd : public CFrameWnd
{
// Constructor
public:
COleCntrFrameWnd(COleIPFrameWnd* pInPlaceFrame);
// Implementation
protected:
COleIPFrameWnd* m_pInPlaceFrame;
virtual void PostNcDestroy();
public:
virtual ~COleCntrFrameWnd();
virtual void RecalcLayout(BOOL bNotify = TRUE);
void OnIdleUpdateCmdUI();
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo);
#ifdef _DEBUG
void AssertValid() const;
#endif
};
/////////////////////////////////////////////////////////////////////////////
// CDialogTemplate
class CDialogTemplate
{
// Constructors
public:
CDialogTemplate(const DLGTEMPLATE* pTemplate = NULL);
CDialogTemplate(HGLOBAL hGlobal);
// Attributes
BOOL HasFont() const;
BOOL SetFont(LPCTSTR lpFaceName, WORD nFontSize);
BOOL SetSystemFont(WORD nFontSize = 0);
BOOL GetFont(CString& strFaceName, WORD& nFontSize) const;
void GetSizeInDialogUnits(SIZE* pSize) const;
void GetSizeInPixels(SIZE* pSize) const;
static BOOL AFX_CDECL GetFont(const DLGTEMPLATE* pTemplate,
CString& strFaceName, WORD& nFontSize);
// Operations
BOOL Load(LPCTSTR lpDialogTemplateID);
HGLOBAL Detach();
// Implementation
public:
~CDialogTemplate();
HGLOBAL m_hTemplate;
DWORD m_dwTemplateSize;
BOOL m_bSystemFont;
protected:
static BYTE* AFX_CDECL GetFontSizeField(const DLGTEMPLATE* pTemplate);
static UINT AFX_CDECL GetTemplateSize(const DLGTEMPLATE* pTemplate);
BOOL SetTemplate(const DLGTEMPLATE* pTemplate, UINT cb);
};
/////////////////////////////////////////////////////////////////////////////
// WM_NOTIFY support
struct AFX_NOTIFY
{
LRESULT* pResult;
NMHDR* pNMHDR;
};
/////////////////////////////////////////////////////////////////////////////
// Global implementation helpers
// window creation hooking
void AFXAPI AfxHookWindowCreate(CWnd* pWnd);
BOOL AFXAPI AfxUnhookWindowCreate();
void AFXAPI AfxResetMsgCache();
// for backward compatibility to previous versions
#define _AfxHookWindowCreate AfxHookWindowCreate
#define _AfxUnhookWindowCreate AfxUnhookWindowCreate
// string helpers
void AFXAPI AfxSetWindowText(HWND hWndCtrl, LPCTSTR lpszNew);
int AFXAPI AfxLoadString(UINT nIDS, LPTSTR lpszBuf, UINT nMaxBuf = 256);
HDC AFXAPI AfxCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode);
void AFXAPI AfxGetModuleShortFileName(HINSTANCE hInst, CString& strShortName);
// Failure dialog helpers
void AFXAPI AfxFailMaxChars(CDataExchange* pDX, int nChars);
void AFXAPI AfxFailRadio(CDataExchange* pDX);
// DLL load helpers
HINSTANCE AFXAPI AfxLoadDll(HINSTANCE* volatile hInst, LPCSTR lpszDLL);
HINSTANCE AFXAPI AfxLoadDll(HINSTANCE* volatile hInst, LPCSTR lpszDLL,
FARPROC* pProcPtrs, LPCSTR lpszProcName);
#ifndef __AFXCONV_H__
#include <afxconv.h>
#endif
/////////////////////////////////////////////////////////////////////////////
#ifdef _AFX_PACKING
#pragma pack(pop)
#endif
#undef AFX_DATA
#define AFX_DATA
#ifdef _AFX_MINREBUILD
#pragma component(minrebuild, on)
#endif
#ifndef _AFX_FULLTYPEINFO
#pragma component(mintypeinfo, off)
#endif
#endif // __AFXPRIV_H__
/////////////////////////////////////////////////////////////////////////////
#ifndef __AFXPRIV2_H__
#include <afxpriv2.h>
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -