📄 afxext.h
字号:
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
virtual void OnInitialUpdate();
protected:
LPCTSTR m_lpszTemplateName;
CCreateContext* m_pCreateContext;
HWND m_hWndFocus; // last window to have focus
virtual void OnDraw(CDC* pDC); // default does nothing
// special case override of child window creation
virtual BOOL Create(LPCTSTR, LPCTSTR, DWORD,
const RECT&, CWnd*, UINT, CCreateContext*);
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual void OnActivateView(BOOL, CView*, CView*);
virtual void OnActivateFrame(UINT, CFrameWnd*);
BOOL SaveFocusControl(); // updates m_hWndFocus
#ifndef _AFX_NO_OCC_SUPPORT
// data and functions necessary for OLE control containment
_AFX_OCC_DIALOG_INFO* m_pOccDialogInfo;
virtual BOOL SetOccDialogInfo(_AFX_OCC_DIALOG_INFO* pOccDialogInfo);
afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM);
#endif
//{{AFX_MSG(CFormView)
afx_msg int OnCreate(LPCREATESTRUCT lpcs);
afx_msg void OnSetFocus(CWnd* pOldWnd);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CEditView - simple text editor view
class CEditView : public CCtrlView
{
DECLARE_DYNCREATE(CEditView)
// Construction
public:
CEditView();
// Attributes
public:
static AFX_DATA const DWORD dwStyleDefault;
// CEdit control access
CEdit& GetEditCtrl() const;
// presentation attributes
CFont* GetPrinterFont() const;
void SetPrinterFont(CFont* pFont);
void SetTabStops(int nTabStops);
// other attributes
void GetSelectedText(CString& strResult) const;
// buffer access
LPCTSTR LockBuffer() const;
void UnlockBuffer() const;
UINT GetBufferLength() const;
// Operations
public:
BOOL FindText(LPCTSTR lpszFind, BOOL bNext = TRUE, BOOL bCase = TRUE);
void SerializeRaw(CArchive& ar);
UINT PrintInsideRect(CDC* pDC, RECT& rectLayout, UINT nIndexStart,
UINT nIndexStop);
// Overrideables
protected:
virtual void OnFindNext(LPCTSTR lpszFind, BOOL bNext, BOOL bCase);
virtual void OnReplaceSel(LPCTSTR lpszFind, BOOL bNext, BOOL bCase,
LPCTSTR lpszReplace);
virtual void OnReplaceAll(LPCTSTR lpszFind, LPCTSTR lpszReplace,
BOOL bCase);
virtual void OnTextNotFound(LPCTSTR lpszFind);
// Implementation
public:
virtual ~CEditView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
virtual void Serialize(CArchive& ar);
virtual void DeleteContents();
void ReadFromArchive(CArchive& ar, UINT nLen);
void WriteToArchive(CArchive& ar);
virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo);
static AFX_DATA const UINT nMaxSize;
// maximum number of characters supported
protected:
int m_nTabStops; // tab stops in dialog units
LPTSTR m_pShadowBuffer; // special shadow buffer only used in Win32s
UINT m_nShadowSize;
CUIntArray m_aPageStart; // array of starting pages
HFONT m_hPrinterFont; // if NULL, mirror display font
HFONT m_hMirrorFont; // font object used when mirroring
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
// printing support
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo = NULL);
BOOL PaginateTo(CDC* pDC, CPrintInfo* pInfo);
// find & replace support
void OnEditFindReplace(BOOL bFindOnly);
BOOL InitializeReplace();
BOOL SameAsSelected(LPCTSTR lpszCompare, BOOL bCase);
// special overrides for implementation
virtual void CalcWindowRect(LPRECT lpClientRect,
UINT nAdjustType = adjustBorder);
//{{AFX_MSG(CEditView)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam);
afx_msg void OnUpdateNeedSel(CCmdUI* pCmdUI);
afx_msg void OnUpdateNeedClip(CCmdUI* pCmdUI);
afx_msg void OnUpdateNeedText(CCmdUI* pCmdUI);
afx_msg void OnUpdateNeedFind(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
afx_msg BOOL OnEditChange();
afx_msg void OnEditCut();
afx_msg void OnEditCopy();
afx_msg void OnEditPaste();
afx_msg void OnEditClear();
afx_msg void OnEditUndo();
afx_msg void OnEditSelectAll();
afx_msg void OnEditFind();
afx_msg void OnEditReplace();
afx_msg void OnEditRepeat();
afx_msg LRESULT OnFindReplaceCmd(WPARAM wParam, LPARAM lParam);
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// CMetaFileDC
class CMetaFileDC : public CDC
{
DECLARE_DYNAMIC(CMetaFileDC)
// Constructors
public:
CMetaFileDC();
BOOL Create(LPCTSTR lpszFilename = NULL);
BOOL CreateEnhanced(CDC* pDCRef, LPCTSTR lpszFileName,
LPCRECT lpBounds, LPCTSTR lpszDescription);
// Operations
HMETAFILE Close();
HENHMETAFILE CloseEnhanced();
// Implementation
public:
virtual void SetAttribDC(HDC hDC); // Set the Attribute DC
protected:
virtual void SetOutputDC(HDC hDC); // Set the Output DC -- Not allowed
virtual void ReleaseOutputDC(); // Release the Output DC -- Not allowed
public:
virtual ~CMetaFileDC();
// Clipping Functions (use the Attribute DC's clip region)
virtual int GetClipBox(LPRECT lpRect) const;
virtual BOOL PtVisible(int x, int y) const;
BOOL PtVisible(POINT point) const;
virtual BOOL RectVisible(LPCRECT lpRect) const;
// Text Functions
virtual BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount);
BOOL TextOut(int x, int y, const CString& str);
virtual BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
LPCTSTR lpszString, UINT nCount, LPINT lpDxWidths);
BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
const CString& str, LPINT lpDxWidths);
virtual CSize TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount,
int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin);
CSize TabbedTextOut(int x, int y, const CString& str,
int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin);
virtual int DrawText(LPCTSTR lpszString, int nCount, LPRECT lpRect,
UINT nFormat);
int DrawText(const CString& str, LPRECT lpRect, UINT nFormat);
// Printer Escape Functions
virtual int Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData);
// Viewport Functions
virtual CPoint SetViewportOrg(int x, int y);
CPoint SetViewportOrg(POINT point);
virtual CPoint OffsetViewportOrg(int nWidth, int nHeight);
virtual CSize SetViewportExt(int x, int y);
CSize SetViewportExt(SIZE size);
virtual CSize ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom);
protected:
void AdjustCP(int cx);
};
/////////////////////////////////////////////////////////////////////////////
// CRectTracker - simple rectangular tracking rectangle w/resize handles
class CRectTracker
{
public:
// Constructors
CRectTracker();
CRectTracker(LPCRECT lpSrcRect, UINT nStyle);
// Style Flags
enum StyleFlags
{
solidLine = 1, dottedLine = 2, hatchedBorder = 4,
resizeInside = 8, resizeOutside = 16, hatchInside = 32,
};
// Hit-Test codes
enum TrackerHit
{
hitNothing = -1,
hitTopLeft = 0, hitTopRight = 1, hitBottomRight = 2, hitBottomLeft = 3,
hitTop = 4, hitRight = 5, hitBottom = 6, hitLeft = 7, hitMiddle = 8
};
// Attributes
UINT m_nStyle; // current state
CRect m_rect; // current position (always in pixels)
CSize m_sizeMin; // minimum X and Y size during track operation
int m_nHandleSize; // size of resize handles (default from WIN.INI)
// Operations
void Draw(CDC* pDC) const;
void GetTrueRect(LPRECT lpTrueRect) const;
BOOL SetCursor(CWnd* pWnd, UINT nHitTest) const;
BOOL Track(CWnd* pWnd, CPoint point, BOOL bAllowInvert = FALSE,
CWnd* pWndClipTo = NULL);
BOOL TrackRubberBand(CWnd* pWnd, CPoint point, BOOL bAllowInvert = TRUE);
int HitTest(CPoint point) const;
int NormalizeHit(int nHandle) const;
// Overridables
virtual void DrawTrackerRect(LPCRECT lpRect, CWnd* pWndClipTo,
CDC* pDC, CWnd* pWnd);
virtual void AdjustRect(int nHandle, LPRECT lpRect);
virtual void OnChangedRect(const CRect& rectOld);
virtual UINT GetHandleMask() const;
// Implementation
public:
virtual ~CRectTracker();
protected:
BOOL m_bAllowInvert; // flag passed to Track or TrackRubberBand
CRect m_rectLast;
CSize m_sizeLast;
BOOL m_bErase; // TRUE if DrawTrackerRect is called for erasing
BOOL m_bFinalErase; // TRUE if DragTrackerRect called for final erase
// implementation helpers
int HitTestHandles(CPoint point) const;
void GetHandleRect(int nHandle, CRect* pHandleRect) const;
void GetModifyPointers(int nHandle, int**ppx, int**ppy, int* px, int*py);
virtual int GetHandleSize(LPCRECT lpRect = NULL) const;
BOOL TrackHandle(int nHandle, CWnd* pWnd, CPoint point, CWnd* pWndClipTo);
void Construct();
};
/////////////////////////////////////////////////////////////////////////////
// Informational data structures
struct CPrintInfo // Printing information structure
{
CPrintInfo();
~CPrintInfo();
CPrintDialog* m_pPD; // pointer to print dialog
BOOL m_bDocObject; // TRUE if printing by IPrint interface
BOOL m_bPreview; // TRUE if in preview mode
BOOL m_bDirect; // TRUE if bypassing Print Dialog
BOOL m_bContinuePrinting;// set to FALSE to prematurely end printing
UINT m_nCurPage; // Current page
UINT m_nNumPreviewPages; // Desired number of preview pages
CString m_strPageDesc; // Format string for page number display
LPVOID m_lpUserData; // pointer to user created struct
CRect m_rectDraw; // rectangle defining current usable page area
// these only valid if m_bDocObject
UINT m_nOffsetPage; // offset of first page in combined IPrint job
DWORD m_dwFlags; // flags passed to IPrint::Print
void SetMinPage(UINT nMinPage);
void SetMaxPage(UINT nMaxPage);
UINT GetMinPage() const;
UINT GetMaxPage() const;
UINT GetFromPage() const;
UINT GetToPage() const;
UINT GetOffsetPage() const;
};
struct CPrintPreviewState // Print Preview context/state
{
UINT nIDMainPane; // main pane ID to hide
HMENU hMenu; // saved hMenu
DWORD dwStates; // Control Bar Visible states (bit map)
CView* pViewActiveOld; // save old active view during preview
BOOL (CALLBACK* lpfnCloseProc)(CFrameWnd* pFrameWnd);
HACCEL hAccelTable; // saved accelerator table
// Implementation
CPrintPreviewState();
};
struct CCreateContext // Creation information structure
// All fields are optional and may be NULL
{
// for creating new views
CRuntimeClass* m_pNewViewClass; // runtime class of view to create or NULL
CDocument* m_pCurrentDoc;
// for creating MDI children (CMDIChildWnd::LoadFrame)
CDocTemplate* m_pNewDocTemplate;
// for sharing view/frame state from the original view/frame
CView* m_pLastView;
CFrameWnd* m_pCurrentFrame;
// Implementation
CCreateContext();
};
/////////////////////////////////////////////////////////////////////////////
// Inline function declarations
#ifdef _AFX_PACKING
#pragma pack(pop)
#endif
#ifdef _AFX_ENABLE_INLINES
#define _AFXEXT_INLINE AFX_INLINE
#include <afxext.inl>
#endif
#undef AFX_DATA
#define AFX_DATA
#ifdef _AFX_MINREBUILD
#pragma component(minrebuild, on)
#endif
#ifndef _AFX_FULLTYPEINFO
#pragma component(mintypeinfo, off)
#endif
#endif //__AFXEXT_H__
/////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -