home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / msgview.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.5 KB  |  131 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. #ifndef _MSGVIEW_H
  19. #define _MSGVIEW_H
  20.  
  21. #include "netsvw.h"
  22.  
  23. class CAttachmentTray: public CWnd {
  24. protected:
  25.     HFONT m_hFont;
  26.     RECT m_rcClient;
  27.  
  28.     // Content data
  29.     class AttachAux {
  30.     public:
  31. #ifdef _WIN32
  32.         HIMAGELIST hImage;
  33. #else
  34.         HICON hIcon;
  35. #endif
  36.         BOOL bSelected;
  37.         POINT ptPos;
  38.     };
  39.  
  40.     int m_nAttachmentCount;
  41.     MSG_AttachmentData *m_pAttachmentData;
  42.     AttachAux *m_aAttachAux;
  43.  
  44.     // Layout stuff
  45.     SIZE m_sizeSpacing, m_sizeIcon;
  46.  
  47.     // Scrolling stuff
  48.     POINT m_ptOrigin;
  49.     SIZE m_sizeMax;
  50.  
  51. public:
  52.     CAttachmentTray();
  53.     ~CAttachmentTray();
  54.  
  55.     void SetAttachments(int nAttachmentCount, MSG_AttachmentData *pAttachmentData);
  56.     void SetCSID(int16 doc_csid, XP_Bool updateWindow = TRUE);
  57.  
  58. protected:
  59.     int Point2Index(POINT pt);
  60.     void Index2Rect(int idx, RECT &rect);
  61.  
  62.     void ClearSelection();
  63.  
  64.     void Layout();
  65.     BOOL WaitForDrag();
  66.     HICON DredgeUpIcon(char *pszName);
  67.  
  68.     afx_msg void OnPaint();
  69.     afx_msg void OnSize( UINT nType, int cx, int cy );
  70.     afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
  71.     afx_msg void OnLButtonDblClk( UINT nFlags, CPoint point );
  72.     afx_msg void OnRButtonDown( UINT nFlags, CPoint point );
  73.     afx_msg void OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar );
  74.     DECLARE_MESSAGE_MAP();
  75. };
  76.  
  77. class CMessageBodyView: public CNetscapeView {
  78.  
  79. protected:
  80.  
  81.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  82.     afx_msg void OnKillFocus( CWnd* pNewWnd );
  83.     DECLARE_MESSAGE_MAP();
  84.     DECLARE_DYNCREATE(CMessageBodyView)
  85. };
  86.  
  87. class CMessageView: public CView {
  88. protected:
  89.     CMessageBodyView *m_pViewMessage;
  90.     CAttachmentTray *m_pWndAttachments;
  91.  
  92.     int m_iAttachmentsHeight;
  93.     int m_iOldHeight;
  94.     int m_nAttachmentCount;
  95.     BOOL m_bAttachmentsVisible;
  96.     int m_iSliderHeight;
  97.     RECT m_rcSlider;
  98.     POINT m_ptHit;
  99.     RECT m_rcClient;
  100.  
  101. public:
  102.     CMessageView();
  103.     ~CMessageView();
  104.  
  105.     void SetAttachments(int nAttachmentCount, MSG_AttachmentData *pAttachmentData);
  106.     void ShowAttachments(BOOL bShow = TRUE);
  107.     BOOL AttachmentsVisible() const;
  108.     void UpdateFocusFrame();
  109.     void SetCSID(int16 doc_csid);
  110.  
  111. protected:
  112.  
  113.     virtual BOOL OnCommand( WPARAM wParam, LPARAM lParam );
  114.     virtual BOOL OnCmdMsg( UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo );
  115.     virtual void OnDraw( CDC* pDC );
  116.  
  117.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  118.     afx_msg void OnSize( UINT nType, int cx, int cy );
  119.     afx_msg BOOL OnSetCursor( CWnd* pWnd, UINT nHitTest, UINT message );
  120.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  121.     afx_msg void OnKillFocus( CWnd* pNewWnd );
  122.     afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
  123.     afx_msg void OnMouseMove( UINT nFlags, CPoint point );
  124.     afx_msg void OnLButtonUp( UINT nFlags, CPoint point );
  125.     afx_msg void OnDestroy();
  126.     DECLARE_MESSAGE_MAP();
  127.     DECLARE_DYNCREATE(CMessageView)
  128. };
  129.  
  130. #endif
  131.