Annotation of mstools/ole20/samples/spoly2/statbar.h, revision 1.1.1.1

1.1       root        1: /*** 
                      2: *statbar.h
                      3: *
                      4: *  Copyright (C) 1992, Microsoft Corporation.  All Rights Reserved.
                      5: *  Information Contained Herein Is Proprietary and Confidential.
                      6: *
                      7: *Purpose:
                      8: *
                      9: *Implementation Notes:
                     10: *  This file requires windows.h and ole2.h
                     11: *
                     12: *****************************************************************************/
                     13: 
                     14: class CStatBar : public IUnknown {
                     15: public:
                     16:     static CStatBar FAR* Create(HANDLE hinst, HWND hwndFrame);
                     17: 
                     18:     // IUnknown methods
                     19:     //
                     20:     STDMETHOD(QueryInterface)(REFIID riid, void FAR* FAR* ppv);
                     21:     STDMETHOD_(ULONG, AddRef)(void);
                     22:     STDMETHOD_(ULONG, Release)(void);
                     23: 
                     24:     // Introduced methods
                     25:     //
                     26:     void Show(void);
                     27:     inline void Move(void);
                     28:     inline void Update(void);
                     29: 
                     30:     inline int GetX(void);
                     31:     inline void SetX(int x);
                     32: 
                     33:     inline int GetY(void);
                     34:     inline void SetY(int y);
                     35: 
                     36:     inline int GetHeight(void);
                     37:     inline void SetHeight(int height);
                     38: 
                     39:     inline int GetWidth(void);
                     40:     inline void SetWidth(int width);
                     41: 
                     42:     //inline HFONT GetFont(void);
                     43:     void SetFont(HFONT hfont);
                     44: 
                     45:     //char FAR* GetText(void);
                     46:     inline void SetText(char FAR* sz);
                     47: 
                     48:     void WMPaint(void);
                     49:     BOOL Register(HANDLE);
                     50: 
                     51: private:
                     52:     CStatBar();
                     53:     ~CStatBar();
                     54: 
                     55:     ULONG      m_refs;
                     56: 
                     57:     HWND       m_hwnd;                 // the status bar window handle
                     58: 
                     59:     int                m_x;                    // x coordinate of upper left corner
                     60:     int                m_y;                    // y coordinate of upper left corner
                     61:     int                m_height;
                     62:     int                m_width;
                     63: 
                     64:     HFONT      m_hfont;
                     65:     int                m_dyFont;               // font height
                     66:     int                m_dxFont;               // font width
                     67: 
                     68:     BSTR       m_bstrMsg;              // the status bar text
                     69: 
                     70:     static char FAR* m_szWndClass;
                     71: };
                     72: 
                     73: inline void
                     74: CStatBar::Move()
                     75: {
                     76:     MoveWindow(m_hwnd, m_x, m_y, m_width, m_height, TRUE);
                     77: }
                     78: 
                     79: inline void
                     80: CStatBar::Update()
                     81: {
                     82:     InvalidateRect(m_hwnd, NULL, TRUE);
                     83:     UpdateWindow(m_hwnd);
                     84: }
                     85: 
                     86: inline int
                     87: CStatBar::GetX()
                     88: {
                     89:     return m_x;
                     90: }
                     91: 
                     92: inline void
                     93: CStatBar::SetX(int x)
                     94: {
                     95:     m_x = x;
                     96: }
                     97: 
                     98: inline int
                     99: CStatBar::GetY(void)
                    100: {
                    101:     return m_y;
                    102: }
                    103: 
                    104: inline void
                    105: CStatBar::SetY(int y)
                    106: {
                    107:     m_y = y;
                    108: }
                    109: 
                    110: inline int
                    111: CStatBar::GetHeight(void)
                    112: {
                    113:     return m_height;
                    114: }
                    115: 
                    116: inline void
                    117: CStatBar::SetHeight(int height)
                    118: {
                    119:     m_height = height;
                    120: }
                    121: 
                    122: inline int
                    123: CStatBar::GetWidth(void)
                    124: {
                    125:     return m_width;
                    126: }
                    127: 
                    128: inline void
                    129: CStatBar::SetWidth(int width)
                    130: {
                    131:     m_width = width;
                    132: }
                    133: 
                    134: inline void
                    135: CStatBar::SetText(char FAR* sz)
                    136: {
                    137:     SysFreeString(m_bstrMsg);
                    138:     m_bstrMsg = SysAllocString(sz);
                    139: }
                    140: 
                    141: extern "C" void
                    142: SBprintf(CStatBar FAR* psb, char FAR* szFmt, ...);

unix.superglobalmegacorp.com

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