home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / medit.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.5 KB  |  153 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.  
  19. // medit.h : header file
  20. //
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CURLBar dialog
  24.  
  25. #ifndef _MEDIT_H_
  26. #define _MEDIT_H_
  27.  
  28. #ifndef _WIN32
  29. #define GET_WM_COMMAND_CMD(wp, lp)    ((UINT)HIWORD(lp))
  30. #endif
  31.  
  32. class far CNetscapeEdit : public CGenericEdit
  33. {
  34.     DECLARE_DYNAMIC(CNetscapeEdit)
  35.  
  36. public:
  37.     CNetscapeEdit();
  38.  
  39. protected:
  40.     MWContext             * m_Context;
  41.     LO_FormElementStruct  * m_Form;
  42.     int                 m_Submit;
  43.     XP_Bool            m_callBase;
  44. #ifdef DEBUG
  45.     XP_Bool m_bOnCreateCalled;
  46. #endif
  47.  
  48. //    Way to get text data out of a form element if it really has some.
  49. protected:
  50.     lo_FormElementTextData *GetTextData();
  51.     XP_Bool            UpdateEditField();
  52.     void                    UpdateAndCheckForChange();
  53.  
  54. #ifdef XP_WIN16 
  55.     // 
  56.     // Functions and bookkeeping to set up proper segment locations for
  57.     //   win16 edit elements
  58.     //
  59. protected:
  60.     HINSTANCE              m_hInstance;
  61.     virtual BOOL PreCreateWindow( CREATESTRUCT& cs );
  62. public:
  63.     inline void SetInstance(HINSTANCE hInst) { m_hInstance = hInst; }
  64. #endif
  65.  
  66. public:
  67.     virtual    void    GetWindowText(CString& rString) { CGenericEdit::GetWindowText(rString); };    // make it virtual so we can overload it in odctrl.h
  68.     virtual    int        GetWindowText(LPTSTR lpszStringBuf, int nMaxCount) { return CGenericEdit::GetWindowText(lpszStringBuf, nMaxCount); };    // make it virtual so we can overload it in odctrl.h
  69.  
  70.     BOOL SetContext(MWContext * context, LO_FormElementStruct * form = NULL);
  71.     LO_FormElementStruct *GetFormElement();
  72.     void OnEditKeyEvent(CL_EventType type, UINT nChar, UINT nRepCnt, UINT nFlags);
  73.  
  74.     inline void SetSubmit(int state) { m_Submit = state; }
  75.     inline void RegisterForm(LO_FormElementStruct * form) { m_Form = form; }
  76.  
  77. protected:
  78.     //{{AFX_MSG(CNetscapeEdit)
  79.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  80.     afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  81.     afx_msg void OnChar(UINT nChar, UINT nCnt, UINT nFlags);
  82.     afx_msg UINT OnGetDlgCode();
  83.     afx_msg void OnSetFocus(CWnd * pOldWnd);
  84.     afx_msg void OnKillFocus(CWnd * pNewWnd);
  85.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  86.     //}}AFX_MSG
  87.  
  88.     DECLARE_MESSAGE_MAP()
  89. };
  90.  
  91. class CMochaListBox : public CListBox
  92. {
  93. protected:
  94.     MWContext            * m_Context;
  95.     LO_FormElementStruct * m_Form;
  96.  
  97. public:
  98.     void SetContext(MWContext * context, LO_FormElementStruct * form = NULL);
  99.     inline void RegisterForm(LO_FormElementStruct * form) { m_Form = form; }
  100.  
  101. protected:
  102.     void CheckForChange();
  103.  
  104. #if !defined(MSVC4)
  105.     // We can't get OnSelChange() calls so do it by hand
  106.     virtual BOOL OnChildNotify(UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  107. #endif    // MSVC4
  108.  
  109.     //{{AFX_MSG(CMochaListBox)
  110.     afx_msg void OnSetFocus(CWnd * pOldWnd);
  111.     afx_msg void OnKillFocus(CWnd * pNewWnd);
  112.     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  113. #if defined(MSVC4)
  114.     afx_msg void OnSelChange();
  115. #endif    // MSVC4
  116.     //}}AFX_MSG
  117.  
  118.     DECLARE_MESSAGE_MAP()
  119. };
  120.  
  121. class CMochaComboBox : public CComboBox
  122. {
  123. protected:
  124.     MWContext            * m_Context;
  125.     LO_FormElementStruct * m_Form;
  126.  
  127. public:
  128.     void SetContext(MWContext * context, LO_FormElementStruct * form = NULL);
  129.     inline void RegisterForm(LO_FormElementStruct * form) { m_Form = form; }
  130.  
  131. protected:
  132.     void CheckForChange();
  133.  
  134. #if !defined(MSVC4)
  135.     // We can't get OnSelChange() calls so do it by hand
  136.     virtual BOOL OnChildNotify(UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  137. #endif    // MSVC4
  138.  
  139.     //{{AFX_MSG(CMochaComboBox)
  140.     afx_msg void OnSetFocus(CWnd * pOldWnd);
  141.     afx_msg void OnKillFocus(CWnd * pNewWnd);
  142.     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  143. #if defined(MSVC4)
  144.     afx_msg void OnSelChange();
  145. #endif    // MSVC4
  146.     //}}AFX_MSG
  147.  
  148.     DECLARE_MESSAGE_MAP()
  149. };
  150.  
  151.  
  152. #endif // _MEDIT_H_
  153.