home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / odctrl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.1 KB  |  102 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. #ifndef __ODCTRL_H
  20. #define __ODCTRL_H
  21.  
  22. //
  23. //    This file contains the declaration of 
  24. //        CODNetscapeButton
  25. //        CODMochaListBox
  26. //        CODMochaComboBox
  27. //
  28. //    Why we need the ownerdrawn version ?
  29. //    1. So we could display UTF8 widget
  30. //    2. So we coudl use Unicode Font on US Win95 to display non-Latin 
  31. //        characters.
  32.  
  33.  
  34. //    Requried include file
  35. #include "button.h"
  36. #include "medit.h"
  37.  
  38. class CODNetscapeButton : public CNetscapeButton {
  39. public:
  40.  
  41.         CODNetscapeButton(MWContext*, LO_FormElementStruct *, CWnd* pParent=NULL);
  42.     virtual void     DrawItem    (LPDRAWITEMSTRUCT);
  43.     virtual void     Draw3DBox    (CDC*, CRect&, BOOL);
  44.     virtual void     DrawContent    (CDC*, LPDRAWITEMSTRUCT);
  45.     virtual void     DrawCenterText    (CDC*, LPCSTR, CRect& );
  46.  
  47. };
  48.  
  49. class CODMochaListBox : public CMochaListBox {
  50. public:
  51.     virtual void    MeasureItem    (LPMEASUREITEMSTRUCT);
  52.     virtual void     DrawItem    (LPDRAWITEMSTRUCT);
  53. };
  54.  
  55. class CODMochaComboBox : public CMochaComboBox {
  56. public:
  57.     virtual void    MeasureItem    (LPMEASUREITEMSTRUCT);
  58.     virtual void     DrawItem    (LPDRAWITEMSTRUCT);
  59. };
  60.  
  61. class CODNetscapeEdit : public CNetscapeEdit {
  62. public:
  63.     CODNetscapeEdit();
  64.     ~CODNetscapeEdit();
  65.     virtual void    SetWindowText(LPCTSTR lpszString);
  66.     virtual    int        GetWindowText(LPTSTR lpszStringBuf, int nMaxCount);
  67.     virtual    void    GetWindowText(CString& rString);
  68.     virtual    int        GetWindowTextLength();
  69.  
  70. #ifdef XP_WIN32
  71.     // advanced creation (allows access to extended styles)
  72.     virtual BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
  73.         LPCTSTR lpszWindowName, DWORD dwStyle,
  74.         int x, int y, int nWidth, int nHeight,
  75.         HWND hWndParent, HMENU nIDorHMenu, LPVOID lpParam = NULL);
  76. #endif
  77.  
  78. private:
  79.     int16    m_set_text_wincsid;
  80.     unsigned char*  m_convertedBuf;
  81.     int                m_convertedBufSize;
  82.     unsigned char*  m_ucs2Buf;
  83.     int                m_ucs2BufSize;
  84.     unsigned char*  m_gettextBuf;
  85.     int                m_gettextBufSize;
  86. protected:
  87.     void        Convert(int16 from, int16 to, unsigned char* lpszString);
  88.     int16        GetWinCSID();
  89.     int16        GetSetWindowTextCSID();
  90.     void        SetSetWindowTextCSID(int16 csid) { m_set_text_wincsid = csid; };
  91.  
  92. #ifdef XP_WIN32
  93.     // We need to overload SetWindowTextW and GetWindowTextW() since the 
  94.     void        SetWindowTextW(HWND hWnd, LPCWSTR lpString);
  95.     int            GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount);
  96. #endif
  97.  
  98. };
  99.  
  100.  
  101. #endif // __ODCTRL_H
  102.