Annotation of mstools/mfc/samples/oclient/itemwnd.h, revision 1.1.1.1

1.1       root        1: // This is a part of the Microsoft Foundation Classes C++ library.
                      2: // Copyright (C) 1992 Microsoft Corporation
                      3: // All rights reserved.
                      4: //
                      5: // This source code is only intended as a supplement to the
                      6: // Microsoft Foundation Classes Reference and Microsoft
                      7: // QuickHelp documentation provided with the library.
                      8: // See these sources for detailed information regarding the
                      9: // Microsoft Foundation Classes product.
                     10: 
                     11: // class CItemWnd - the window containing an embedded OLE object
                     12: 
                     13: #ifndef __AFXOLE_H__
                     14: #include <afxole.h>
                     15: #endif
                     16: 
                     17: class CItemWnd;
                     18: 
                     19: // A special COleClientItem that points to the UI for it
                     20: class CEmbeddedItem : public COleClientItem
                     21:        // embedded or linked
                     22: {
                     23:        CItemWnd*   m_pView;        // view on this item
                     24: 
                     25: public:
                     26:        CEmbeddedItem(COleClientDoc* pContainer, CItemWnd* pView)
                     27:                : COleClientItem(pContainer)
                     28:                { m_pView = pView; }
                     29: 
                     30: // Operations
                     31:        void    SetNames();
                     32: 
                     33: // Callbacks
                     34: protected:
                     35:        virtual void OnChange(OLE_NOTIFICATION wNotification);
                     36:        virtual void WaitForServer();   // special hourglass
                     37: };
                     38: 
                     39: 
                     40: // Special class for tieing an OLEOBJECT and a WINDOW
                     41: class CItemWnd : public CWnd
                     42: {
                     43: public:
                     44:        CItemWnd(CMainWnd* pContainer);
                     45: 
                     46:        BOOL    CreateItemWindow(BOOL fShow);
                     47:        BOOL    RestoreItemWindow(const RECT& rect);
                     48: 
                     49: // Attributes
                     50:        BOOL IsComplete()       // BLANK objects are incomplete 
                     51:                        { return m_fVisible; }
                     52:        BOOL CanChangeBounds()
                     53:                        { return (!m_fVisible || m_fTrackSize); }
                     54:        CEmbeddedItem*  GetEmbedded()
                     55:                                { return &m_embedded; }
                     56: 
                     57: 
                     58: // Operations
                     59:        void Dirty()
                     60:                        { m_pContainer->Dirty(); }
                     61: 
                     62:        void DoVerb(UINT nVerb);
                     63:        void SetInitialBounds(const CRect& rect);
                     64:        void Select(BOOL bOn);
                     65: 
                     66: // Callbacks - for Window part
                     67: protected:
                     68:        afx_msg void OnPaint();
                     69:        afx_msg void OnSize(UINT nType, int cx, int cy);
                     70:        afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
                     71:        afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
                     72:        afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
                     73:        afx_msg void OnMouseMove(UINT nFlags, CPoint point);
                     74:        afx_msg BOOL OnEraseBkgnd(CDC* pDC);
                     75:        virtual void PostNcDestroy();     // for cleanup
                     76: 
                     77: // Implementation
                     78: public:
                     79:        virtual void Serialize(CArchive& ar);       // from CObject
                     80: #ifdef _DEBUG
                     81:        virtual void AssertValid() const;
                     82: #endif
                     83: 
                     84: protected:
                     85:        CMainWnd* m_pContainer;     // our parent window/container
                     86:        BOOL    m_fVisible;       // is item to be displayed ?
                     87:        BOOL    m_fTrackSize;     // is item's size autoupdate ?
                     88: 
                     89:        // Capture/dragging support
                     90:        BOOL    m_fCaptured;
                     91:        static CRect dragRect;
                     92:        static CPoint dragPt;
                     93: 
                     94: // Item bound to item window
                     95:        CEmbeddedItem   m_embedded;
                     96:        void OnCommonChange(BOOL fDestroyOnError);
                     97: 
                     98:        DECLARE_MESSAGE_MAP()
                     99: 
                    100:        friend class CEmbeddedItem;
                    101: };
                    102: 
                    103: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.