home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / srchfrm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  11.3 KB  |  414 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. // srchfrm.h : header file
  19. //
  20. #ifndef SEARCHFRM_H
  21. #define SEARCHFRM_H
  22. #include "outliner.h"
  23. #include "mailmisc.h"
  24. #include "statbar.h"
  25. #include "msg_srch.h"
  26. #include "srchobj.h"
  27. #ifndef _WIN32
  28. #include "ctl3d.h"
  29. #endif
  30.  
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CSearchBar
  34.  
  35. class CSearchBar : public CDialogBar
  36. {
  37. public:
  38.     CSearchBar ( );
  39.     ~CSearchBar ( );
  40.  
  41. // Attributes
  42. public:
  43.     CMailFolderCombo m_wndScopes;
  44.     CSearchObject m_searchObj;
  45.     int m_iMoreCount;
  46.     BOOL m_bLogicType;
  47.     BOOL m_bLDAP;
  48.     int m_iOrigFrameHeight;
  49.  
  50.     MSG_ScopeAttribute DetermineScope( DWORD dwData );
  51.  
  52.     void UpdateAttribList();
  53.     void UpdateOpList();
  54.     void UpdateOpList(int);
  55.     int More();
  56.     int Fewer();
  57.     void OnAndOr();
  58.     void Advanced();
  59.     int ChangeLogicText();
  60.     void InitializeAttributes (MSG_SearchValueWidget widgetValue, MSG_SearchAttribute attribValue);
  61.     void BuildQuery (MSG_Pane* searchPane);
  62.  
  63.     int ClearSearch(BOOL bIsLDAPSearch);
  64.  
  65. protected:
  66.     int m_iWidth, m_iHeight;
  67.     int GetHeightNeeded();
  68.  
  69. #ifdef XP_WIN16
  70.     CSize m_sizeDefault;
  71. #endif
  72.  
  73.     // ClassWizard generated virtual function overrides
  74.     //{{AFX_VIRTUAL(CSearchBar)
  75. public:
  76.     BOOL Create( CWnd*, UINT, UINT, UINT );
  77.     CSize CalcFixedLayout( BOOL, BOOL );
  78.     //}}AFX_VIRTUAL
  79.  
  80. public:    
  81.     // Generated message map functions
  82.     //{{AFX_MSG(CSearchBar)
  83.     afx_msg int OnCreate( LPCREATESTRUCT );
  84.     afx_msg void OnSize ( UINT, int , int );
  85.     //}}AFX_MSG
  86. #ifndef _WIN32
  87.     afx_msg LRESULT OnDlgSubclass(WPARAM wParam, LPARAM lParam);
  88.  
  89. #endif
  90.     DECLARE_MESSAGE_MAP()
  91. };
  92.  
  93. /////////////////////////////////////////////////////////////////////////////
  94. // CSearchFrame frame
  95.  
  96. class CSearchOutliner;
  97. class IMsgList;
  98. class CAdvSearchOptionsDlg;
  99. class CCustomHeadersDlg;
  100. class CMailQFButton;
  101.  
  102. class CSearchFrame : public CFrameWnd, public CStubsCX
  103. {
  104.     friend class CSearchResultsList;
  105.  
  106. // Attributes
  107. public:
  108.     CNetscapeStatusBar m_barStatus;
  109. protected:
  110.     CSearchBar m_barSearch;
  111.     CDialogBar m_barAction;
  112.     CAdvSearchOptionsDlg *m_pAdvancedOptionsDlg;
  113.     CCustomHeadersDlg *m_pCustomHeadersDlg;
  114.  
  115.     XP_List *m_listSearch;
  116.     XP_List *m_listResult;
  117.  
  118.     BOOL m_bResultsShowing, m_bSearching, m_bIsLDAPSearch;
  119.     int m_iHeight, m_iWidth;
  120.     BOOL m_bDragCopying;
  121.     int m_iRowSelected;
  122.     CSearchOutliner *m_pOutliner;
  123.     MSG_Pane *m_pSearchPane;
  124.     IMsgList *m_pIMsgList;
  125.     MSG_Master *m_pMaster;
  126.     
  127.     int m_iOrigFrameHeight;
  128.     char * m_helpString;
  129.  
  130.     void ShowResults( BOOL );
  131.  
  132.     // From CStubsCX
  133.     virtual void Progress(MWContext *pContext, const char *pMessage);
  134.     virtual void SetProgressBarPercent(MWContext *pContext, int32 lPercent);
  135.     virtual void AllConnectionsComplete(MWContext *pContext);
  136.     virtual CWnd *GetDialogOwner() const { return (CWnd *) this; }
  137.  
  138.  
  139. // Operations
  140.     void Create();
  141.  
  142.     void UpdateScopes( CMailNewsFrame *pFrame );
  143.  
  144. public:
  145.     CSearchFrame();
  146.     void ModalStatusBegin( int iModalDelay );
  147.     void ModalStatusEnd();
  148. #ifndef _WIN32
  149.     CWnd *CreateView(CCreateContext* pContext, UINT nID = AFX_IDW_PANE_FIRST);
  150. #endif
  151.     static void Open();
  152.     static void Open( CMailNewsFrame *pFrame );
  153.     static void Close();
  154.  
  155. protected:
  156.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  157.     virtual BOOL OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext );
  158.     virtual void PostNcDestroy() {}; // Overridden to prevent auto-delete on destroy
  159.  
  160.     //Taken from MailFrm.h :  required to get FolderInfo from a Menu ID
  161.     //Thanks Will!!
  162.     virtual MSG_FolderInfo *FolderInfoFromMenuID( MSG_FolderInfo *mailRoot,
  163.                                                   UINT &nBase, UINT nID );
  164.     virtual MSG_FolderInfo *FolderInfoFromMenuID( UINT nID );
  165.  
  166.  
  167.  
  168.     // IMsgList implementation
  169.     virtual void ListChangeStarting( MSG_Pane* pane, XP_Bool asynchronous,
  170.                                      MSG_NOTIFY_CODE notify, MSG_ViewIndex where,
  171.                                      int32 num);
  172.     virtual void ListChangeFinished( MSG_Pane* pane, XP_Bool asynchronous,
  173.                                      MSG_NOTIFY_CODE notify, MSG_ViewIndex where,
  174.                                      int32 num);
  175.     virtual void GetSelection( MSG_Pane* pane, MSG_ViewIndex **indices, int *count, 
  176.                                 int *focus) {}
  177.     virtual void SelectItem( MSG_Pane* pane, int item ) {}
  178.  
  179. // Implementation
  180. protected:
  181.     virtual ~CSearchFrame();
  182.  
  183. #ifndef ON_COMMAND_RANGE
  184.     BOOL OnCommand( WPARAM wParam, LPARAM lParam );
  185. #endif
  186.  
  187. #ifndef ON_UPDATE_COMMAND_UI_RANGE
  188.     virtual BOOL OnCmdMsg( UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo );  
  189. #endif
  190.     BOOL PreTranslateMessage( MSG* pMsg );
  191.  
  192.     void AdjustHeight(int dy);
  193.     void EditHeader(int iRow); //Brings up Modeless dialog to edit headers.
  194.  
  195.     afx_msg int OnCreate(LPCREATESTRUCT);
  196.     afx_msg void OnClose();
  197.     afx_msg void OnDestroy();
  198.     afx_msg void OnSize(UINT, int, int);
  199.     afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );
  200.     afx_msg void OnMore();
  201.     afx_msg void OnUpdateMore( CCmdUI *pCmdUI );
  202.     afx_msg void OnFewer();
  203.     afx_msg void OnUpdateFewer( CCmdUI *pCmdUI );
  204.     afx_msg void OnFind();
  205.     afx_msg void OnUpdateFind( CCmdUI *pCmdUI );
  206.     afx_msg void OnUpdateQuery( CCmdUI *pCmdUI );
  207.     afx_msg void OnScope();
  208.     afx_msg void OnSave();
  209.     afx_msg void OnTo();
  210.     afx_msg void OnUpdateTo( CCmdUI *pCmdUI );
  211.     afx_msg void OnHelp();
  212.     afx_msg void OnUpdateSave( CCmdUI *pCmdUI );
  213.     afx_msg void OnUpdateHelp( CCmdUI *pCmdUI );
  214.     afx_msg void OnNew();
  215.     afx_msg void OnAdvanced();
  216.     afx_msg void OnUpdateAdvanced(CCmdUI *pCmdUI );
  217.     afx_msg void OnAttrib1();
  218.     afx_msg void OnAttrib2();
  219.     afx_msg void OnAttrib3();
  220.     afx_msg void OnAttrib4();
  221.     afx_msg void OnAttrib5();
  222.     afx_msg    void OnAndOr();
  223.     afx_msg void OnUpdateAndOr(CCmdUI *pCmdUI );
  224.     afx_msg void OnFileButton();
  225.     afx_msg void OnUpdateFileButton(CCmdUI *pCmdUI );
  226.     afx_msg LONG OnFinishedAdvanced( WPARAM wParam, LPARAM lParam );
  227.     afx_msg LONG OnFinishedHeaders(WPARAM wParam, LPARAM lParam );
  228.  
  229.     //context menu handlers
  230.     afx_msg void OnUpdateDeleteMessage(CCmdUI* pCmdUI);
  231.     afx_msg void OnDeleteMessage();
  232.     afx_msg void OnFileMessage(UINT nID );
  233.     afx_msg void OnUpdateFile( CCmdUI *pCmdUI );
  234.     afx_msg void OnOpenMessage();
  235.     afx_msg void OnUpdateOpenMessage(CCmdUI *pCmdUI);
  236.     
  237.  
  238.     DECLARE_MESSAGE_MAP()
  239.  
  240. };
  241.  
  242.  
  243. /////////////////////////////////////////////////////////////////////////////
  244. // CSearchOutliner
  245.  
  246. class CSearchOutlinerParent;
  247.  
  248. class CSearchOutliner : public CMSelectOutliner
  249. {
  250. friend class CSearchOutlinerParent;
  251.  
  252. protected:
  253.     MWContext           *m_pContext;
  254.     MSG_SearchAttribute m_attribSortBy;
  255.     XP_Bool                m_bSortDescending;
  256.     MSG_Pane            *m_pSearchPane;
  257.     HFONT               m_hFont;
  258.     int                    m_iMysticPlane;
  259.     CLIPFORMAT          m_cfSearchMessages;
  260.  
  261.     virtual void OnSelChanged();
  262.     virtual void OnSelDblClk();
  263.  
  264. public:
  265.     CSearchOutliner ( );
  266.     ~CSearchOutliner ( );
  267.  
  268.     void ChangeResults (int num);
  269.  
  270.     virtual LPCTSTR GetColumnText ( UINT iColumn, void * pLineData );
  271.     virtual void * AcquireLineData ( int iLine );
  272.     virtual void ReleaseLineData ( void * pLineData );
  273.     virtual HFONT GetLineFont( void *pLineData );
  274.     virtual void GetTreeInfo ( int iLine, uint32 * pFlags, int * iDepth, 
  275.                                OutlinerAncestorInfo ** pAncestor );
  276.     virtual int TranslateIcon ( void *);
  277.     virtual int TranslateIconFolder ( void *);
  278.  
  279.     virtual void MysticStuffStarting( XP_Bool asynchronous,
  280.                                      MSG_NOTIFY_CODE notify, 
  281.                                      MSG_ViewIndex where,
  282.                                      int32 num);
  283.     virtual void MysticStuffFinishing( XP_Bool asynchronous,
  284.                                       MSG_NOTIFY_CODE notify, 
  285.                                       MSG_ViewIndex where,
  286.                                       int32 num);
  287.  
  288.  
  289.     virtual void PropertyMenu ( int iSel, UINT flags );
  290.     virtual BOOL DeleteItem ( int iLine );
  291.  
  292.     MWContext *GetContext() { return m_pContext; }
  293.     void SetContext( MWContext *pContext ) { m_pContext = pContext; }
  294.     void SetPane (MSG_Pane *pPane) { m_pSearchPane = pPane; }
  295.     
  296.     POINT GetHit() const {return m_ptHit;}
  297.  
  298.     //Drad and Drop
  299.     virtual void InitializeClipFormats(void);
  300.     CLIPFORMAT *GetClipFormatList(void);
  301.     virtual COleDataSource * GetDataSource(void);
  302.  
  303.     afx_msg int OnCreate ( LPCREATESTRUCT );
  304.     DECLARE_MESSAGE_MAP()
  305.  
  306. };
  307.  
  308. /////////////////////////////////////////////////////////////////////////////
  309. // CSearchOutlinerParent
  310.  
  311. class CSearchOutlinerParent : public COutlinerParent 
  312. {
  313. public:
  314.     virtual COutliner * GetOutliner ( );
  315.     virtual void CreateColumns ( );
  316.     virtual BOOL RenderData ( int idColumn, CRect & rect, CDC & dc, const char *);
  317.     virtual BOOL ColumnCommand ( int idColumn );
  318. };
  319.  
  320. /////////////////////////////////////////////////////////////////////////////
  321. // CSearchView
  322.  
  323. class CSearchView: public COutlinerView {
  324.     DECLARE_DYNCREATE(CSearchView)
  325. public:
  326.     CSearchView ( ) : COutlinerView ( )
  327.     {
  328.         m_pOutlinerParent = new CSearchOutlinerParent;
  329.     }
  330. };
  331.  
  332. /////////////////////////////////////////////////////////////////////////////
  333. // CLDAPSearchFrame
  334.  
  335. class CLDAPSearchFrame : public CSearchFrame
  336. {
  337. protected:
  338. // Operations
  339.     void Create();
  340.  
  341. public:
  342.     static void Open();
  343.     static void Close();
  344.  
  345. // Implementation
  346. protected:
  347.     virtual BOOL OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext );
  348.     
  349.     afx_msg int OnCreate(LPCREATESTRUCT);
  350.     afx_msg void OnClose();
  351.     afx_msg void OnScope();
  352.     afx_msg void OnFind();
  353.     afx_msg void OnAdd();
  354.     afx_msg void OnUpdateAdd( CCmdUI *pCmdUI );
  355.     afx_msg void OnTo();
  356.     afx_msg void OnUpdateTo( CCmdUI *pCmdUI );
  357.     DECLARE_MESSAGE_MAP()
  358. };
  359.  
  360. /////////////////////////////////////////////////////////////////////////////
  361. // CLDAPSearchOutliner
  362.  
  363. class CLDAPSearchOutliner: public CSearchOutliner
  364. {
  365. friend class CLDAPSearchOutlinerParent;
  366.  
  367. public:
  368.     virtual int TranslateIcon ( void *);
  369.     virtual HFONT GetLineFont( void *);
  370.  
  371.     //Drag and Drop
  372.     virtual void InitializeClipFormats(void);
  373.     CLIPFORMAT *GetClipFormatList(void);
  374.     virtual COleDataSource * GetDataSource(void);
  375.  
  376.  
  377. protected:
  378.  
  379.     CLIPFORMAT    m_cfAddresses;
  380.     CLIPFORMAT    m_cfSourceTarget;
  381.  
  382.     // Generated message map functions
  383.     //{{AFX_MSG(CLDAPSearchOutliner)
  384.     afx_msg int OnCreate ( LPCREATESTRUCT );
  385.     //}}AFX_MSG
  386.     DECLARE_MESSAGE_MAP()
  387. };
  388.  
  389. /////////////////////////////////////////////////////////////////////////////
  390. // CLPADSearchOutlinerParent
  391.  
  392. class CLDAPSearchOutlinerParent : public CSearchOutlinerParent 
  393. {
  394. public:
  395.     virtual COutliner * GetOutliner ( );
  396.     virtual void CreateColumns ( );
  397. };
  398.  
  399. /////////////////////////////////////////////////////////////////////////////
  400. // CLDAPSearchView
  401.  
  402. class CLDAPSearchView: public COutlinerView {
  403.     DECLARE_DYNCREATE(CLDAPSearchView)
  404. public:
  405.     CLDAPSearchView ( ) : COutlinerView ( )
  406.     {
  407.         m_pOutlinerParent = new CLDAPSearchOutlinerParent;
  408.     }
  409. };
  410.  
  411. ////////////////////////////////////////////////////////////////////////////
  412.  
  413. #endif
  414.