?? afxext.h
字號:
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#ifndef __AFXEXT_H__
#define __AFXEXT_H__
#ifndef __AFXWIN_H__
#include <afxwin.h>
#endif
#ifndef __AFXDLGS_H__
#include <afxdlgs.h>
#endif
#ifdef _AFX_MINREBUILD
#pragma component(minrebuild, off)
#endif
#ifndef _AFX_FULLTYPEINFO
#pragma component(mintypeinfo, on)
#endif
#ifdef _AFX_PACKING
#pragma pack(push, _AFX_PACKING)
#endif
/////////////////////////////////////////////////////////////////////////////
// AFXEXT - MFC Advanced Extensions and Advanced Customizable classes
// Classes declared in this file
//CObject
//CCmdTarget;
//CWnd
//CButton
class CBitmapButton; // Bitmap button (self-draw)
class CControlBar; // control bar
class CStatusBar; // status bar
class CToolBar; // toolbar
class CDialogBar; // dialog as control bar
class CReBar; // ie40 dock bar
class CSplitterWnd; // splitter manager
//CView
//CScrollView
class CFormView; // view with a dialog template
class CEditView; // simple text editor view
//CDC
class CMetaFileDC; // a metafile with proxy
class CRectTracker; // tracker for rectangle objects
// information structures
struct CPrintInfo; // Printing context
struct CPrintPreviewState; // Print Preview context/state
struct CCreateContext; // Creation context
#undef AFX_DATA
#define AFX_DATA AFX_CORE_DATA
/////////////////////////////////////////////////////////////////////////////
// Simple bitmap button
// CBitmapButton - push-button with 1->4 bitmap images
class CBitmapButton : public CButton
{
DECLARE_DYNAMIC(CBitmapButton)
public:
// Construction
CBitmapButton();
BOOL LoadBitmaps(LPCTSTR lpszBitmapResource,
LPCTSTR lpszBitmapResourceSel = NULL,
LPCTSTR lpszBitmapResourceFocus = NULL,
LPCTSTR lpszBitmapResourceDisabled = NULL);
BOOL LoadBitmaps(UINT nIDBitmapResource,
UINT nIDBitmapResourceSel = 0,
UINT nIDBitmapResourceFocus = 0,
UINT nIDBitmapResourceDisabled = 0);
BOOL AutoLoad(UINT nID, CWnd* pParent);
// Operations
void SizeToContent();
// Implementation:
public:
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// all bitmaps must be the same size
CBitmap m_bitmap; // normal image (REQUIRED)
CBitmap m_bitmapSel; // selected image (OPTIONAL)
CBitmap m_bitmapFocus; // focused but not selected (OPTIONAL)
CBitmap m_bitmapDisabled; // disabled bitmap (OPTIONAL)
virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
};
/////////////////////////////////////////////////////////////////////////////
// Control Bars
// forward declarations (private to implementation)
class CDockBar;
class CDockContext;
class CControlBarInfo;
struct AFX_SIZEPARENTPARAMS;
// Layout Modes for CalcDynamicLayout
#define LM_STRETCH 0x01 // same meaning as bStretch in CalcFixedLayout. If set, ignores nLength
// and returns dimensions based on LM_HORZ state, otherwise LM_HORZ is used
// to determine if nLength is the desired horizontal or vertical length
// and dimensions are returned based on nLength
#define LM_HORZ 0x02 // same as bHorz in CalcFixedLayout
#define LM_MRUWIDTH 0x04 // Most Recently Used Dynamic Width
#define LM_HORZDOCK 0x08 // Horizontal Docked Dimensions
#define LM_VERTDOCK 0x10 // Vertical Docked Dimensions
#define LM_LENGTHY 0x20 // Set if nLength is a Height instead of a Width
#define LM_COMMIT 0x40 // Remember MRUWidth
#ifdef _AFXDLL
class CControlBar : public CWnd
#else
class AFX_NOVTABLE CControlBar : public CWnd
#endif
{
DECLARE_DYNAMIC(CControlBar)
// Construction
protected:
CControlBar();
// Attributes
public:
int GetCount() const;
// for styles specific to CControlBar
DWORD GetBarStyle();
void SetBarStyle(DWORD dwStyle);
BOOL m_bAutoDelete;
// getting and setting border space
void SetBorders(LPCRECT lpRect);
void SetBorders(int cxLeft = 0, int cyTop = 0, int cxRight = 0, int cyBottom = 0);
CRect GetBorders() const;
CFrameWnd* GetDockingFrame() const;
BOOL IsFloating() const;
virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
// Operations
void EnableDocking(DWORD dwDockStyle);
// Overridables
virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler) = 0;
// Implementation
public:
virtual ~CControlBar();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
virtual void DelayShow(BOOL bShow);
virtual BOOL IsVisible() const;
virtual DWORD RecalcDelayShow(AFX_SIZEPARENTPARAMS* lpLayout);
virtual BOOL IsDockBar() const;
virtual BOOL DestroyWindow();
virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle);
// info about bar (for status bar and toolbar)
int m_cxLeftBorder, m_cxRightBorder;
int m_cyTopBorder, m_cyBottomBorder;
int m_cxDefaultGap; // default gap value
UINT m_nMRUWidth; // For dynamic resizing.
// array of elements
int m_nCount;
void* m_pData; // m_nCount elements - type depends on derived class
// support for delayed hide/show
enum StateFlags
{ delayHide = 1, delayShow = 2, tempHide = 4, statusSet = 8 };
UINT m_nStateFlags;
// support for docking
DWORD m_dwStyle; // creation style (used for layout)
DWORD m_dwDockStyle;// indicates how bar can be docked
CFrameWnd* m_pDockSite; // current dock site, if dockable
CDockBar* m_pDockBar; // current dock bar, if dockable
CDockContext* m_pDockContext; // used during dragging
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void PostNcDestroy();
virtual void DoPaint(CDC* pDC);
void DrawBorders(CDC* pDC, CRect& rect);
void DrawGripper(CDC* pDC, const CRect& rect);
// implementation helpers
virtual LRESULT WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
void CalcInsideRect(CRect& rect, BOOL bHorz) const; // adjusts borders etc
BOOL AllocElements(int nElements, int cbElement);
virtual BOOL SetStatusText(int nHit);
void ResetTimer(UINT nEvent, UINT nTime);
void EraseNonClient();
void GetBarInfo(CControlBarInfo* pInfo);
void SetBarInfo(CControlBarInfo* pInfo, CFrameWnd* pFrameWnd);
//{{AFX_MSG(CControlBar)
afx_msg void OnTimer(UINT nIDEvent);
afx_msg int OnCreate(LPCREATESTRUCT lpcs);
afx_msg void OnDestroy();
afx_msg void OnPaint();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
afx_msg LRESULT OnSizeParent(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnHelpHitTest(WPARAM wParam, LPARAM lParam);
afx_msg void OnInitialUpdate();
afx_msg LRESULT OnIdleUpdateCmdUI(WPARAM wParam, LPARAM lParam);
afx_msg void OnLButtonDown(UINT nFlags, CPoint pt );
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint pt);
afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT nMsg);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
friend class CFrameWnd;
friend class CDockBar;
};
/////////////////////////////////////////////////////////////////////////////
// CStatusBar control
class CStatusBarCtrl; // forward reference (see afxcmn.h for definition)
struct AFX_STATUSPANE; // private to implementation
class CStatusBar : public CControlBar
{
DECLARE_DYNAMIC(CStatusBar)
// Construction
public:
CStatusBar();
BOOL Create(CWnd* pParentWnd,
DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_BOTTOM,
UINT nID = AFX_IDW_STATUS_BAR);
BOOL CreateEx(CWnd* pParentWnd, DWORD dwCtrlStyle = 0,
DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_BOTTOM,
UINT nID = AFX_IDW_STATUS_BAR);
BOOL SetIndicators(const UINT* lpIDArray, int nIDCount);
// Attributes
public:
void SetBorders(LPCRECT lpRect);
void SetBorders(int cxLeft = 0, int cyTop = 0, int cxRight = 0, int cyBottom = 0);
// standard control bar things
int CommandToIndex(UINT nIDFind) const;
UINT GetItemID(int nIndex) const;
void GetItemRect(int nIndex, LPRECT lpRect) const;
// specific to CStatusBar
void GetPaneText(int nIndex, CString& rString) const;
CString GetPaneText(int nIndex) const;
BOOL SetPaneText(int nIndex, LPCTSTR lpszNewText, BOOL bUpdate = TRUE);
void GetPaneInfo(int nIndex, UINT& nID, UINT& nStyle, int& cxWidth) const;
void SetPaneInfo(int nIndex, UINT nID, UINT nStyle, int cxWidth);
UINT GetPaneStyle(int nIndex) const;
void SetPaneStyle(int nIndex, UINT nStyle);
// for direct access to the underlying common control
CStatusBarCtrl& GetStatusBarCtrl() const;
// Overridables
virtual void DrawItem(LPDRAWITEMSTRUCT);
// Implementation
public:
virtual ~CStatusBar();
virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
BOOL PreCreateWindow(CREATESTRUCT& cs);
BOOL AllocElements(int nElements, int cbElement);
void CalcInsideRect(CRect& rect, BOOL bHorz) const;
virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle);
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
void EnableDocking(DWORD dwDockStyle);
#endif
virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
protected:
int m_nMinHeight;
AFX_STATUSPANE* _GetPanePtr(int nIndex) const;
void UpdateAllPanes(BOOL bUpdateRects, BOOL bUpdateText);
virtual BOOL OnChildNotify(UINT message, WPARAM, LPARAM, LRESULT*);
//{{AFX_MSG(CStatusBar)
afx_msg UINT OnNcHitTest(CPoint);
afx_msg void OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS*);
afx_msg void OnNcPaint();
afx_msg void OnPaint();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnWindowPosChanging(LPWINDOWPOS);
afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnGetText(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnGetTextLength(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnSetMinHeight(WPARAM wParam, LPARAM lParam);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
// Styles for status bar panes
#define SBPS_NORMAL 0x0000
#define SBPS_NOBORDERS SBT_NOBORDERS
#define SBPS_POPOUT SBT_POPOUT
#define SBPS_OWNERDRAW SBT_OWNERDRAW
#define SBPS_DISABLED 0x04000000
#define SBPS_STRETCH 0x08000000 // stretch to fill status bar
/////////////////////////////////////////////////////////////////////////////
// CToolBar control
HBITMAP AFXAPI AfxLoadSysColorBitmap(HINSTANCE hInst, HRSRC hRsrc, BOOL bMono = FALSE);
class CToolBarCtrl; // forward reference (see afxcmn.h for definition)
class CToolBar : public CControlBar
{
DECLARE_DYNAMIC(CToolBar)
// Construction
public:
CToolBar();
BOOL Create(CWnd* pParentWnd,
DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
UINT nID = AFX_IDW_TOOLBAR);
BOOL CreateEx(CWnd* pParentWnd, DWORD dwCtrlStyle = TBSTYLE_FLAT,
DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP,
CRect rcBorders = CRect(0, 0, 0, 0),
UINT nID = AFX_IDW_TOOLBAR);
void SetSizes(SIZE sizeButton, SIZE sizeImage);
// button size should be bigger than image
void SetHeight(int cyHeight);
// call after SetSizes, height overrides bitmap size
BOOL LoadToolBar(LPCTSTR lpszResourceName);
BOOL LoadToolBar(UINT nIDResource);
BOOL LoadBitmap(LPCTSTR lpszResourceName);
BOOL LoadBitmap(UINT nIDResource);
BOOL SetBitmap(HBITMAP hbmImageWell);
BOOL SetButtons(const UINT* lpIDArray, int nIDCount);
// lpIDArray can be NULL to allocate empty buttons
// Attributes
public:
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -