Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
2.4 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: flexcombobox.h
  3. //
  4. // Desc: Implements a combo box control similar to Windows combo box.
  5. // CFlexComboBox is derived from CFlexWnd. It is used by the page
  6. // for player list and genre list. When the combo box is open,
  7. // CFlexComboBox uses a CFlexListBox for the list window.
  8. //
  9. // Copyright (C) 1999-2000 Microsoft Corporation. All Rights Reserved.
  10. //-----------------------------------------------------------------------------
  11. #ifndef __FLEXCOMBOBOX_H__
  12. #define __FLEXCOMBOBOX_H__
  13. #include "flexlistbox.h"
  14. #define FCBF_DEFAULT 0
  15. enum {
  16. FCBN_SELCHANGE,
  17. FCBN_MOUSEOVER
  18. };
  19. struct FLEXCOMBOBOXCREATESTRUCT {
  20. DWORD dwSize;
  21. DWORD dwFlags;
  22. DWORD dwListBoxFlags;
  23. HWND hWndParent;
  24. HWND hWndNotify;
  25. BOOL bVisible;
  26. RECT rect;
  27. HFONT hFont;
  28. COLORREF rgbText, rgbBk, rgbSelText, rgbSelBk, rgbFill, rgbLine;
  29. int nSBWidth;
  30. };
  31. class CFlexComboBox : public CFlexWnd
  32. {
  33. public:
  34. CFlexComboBox();
  35. ~CFlexComboBox();
  36. // creation
  37. BOOL Create(FLEXCOMBOBOXCREATESTRUCT *);
  38. // cosmetics
  39. void SetFont(HFONT hFont);
  40. void SetColors(COLORREF text, COLORREF bk, COLORREF seltext, COLORREF selbk, COLORREF fill, COLORREF line);
  41. // setup
  42. int AddString(LPCTSTR); // returns index
  43. // interaction
  44. void SetSel(int i);
  45. int GetSel();
  46. LPCTSTR GetText();
  47. protected:
  48. virtual void OnPaint(HDC hDC);
  49. virtual LRESULT WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
  50. private:
  51. HWND m_hWndNotify;
  52. COLORREF m_rgbText, m_rgbBk, m_rgbSelText, m_rgbSelBk, m_rgbFill, m_rgbLine;
  53. HFONT m_hFont;
  54. int m_nSBWidth;
  55. int m_nTextHeight;
  56. DWORD m_dwFlags;
  57. DWORD m_dwListBoxFlags;
  58. enum FCBSTATEEVENT {
  59. FCBSE_DOWN,
  60. FCBSE_UPBOX,
  61. FCBSE_UPLIST,
  62. FCBSE_UPOFF,
  63. FCBSE_DOWNOFF
  64. };
  65. enum FCBSTATE {
  66. FCBS_CLOSED,
  67. FCBS_OPENDOWN,
  68. FCBS_OPENUP,
  69. FCBS_CANCEL,
  70. FCBS_SELECT
  71. };
  72. FCBSTATE m_eCurState;
  73. void StateEvent(FCBSTATEEVENT e);
  74. void SetState(FCBSTATE s);
  75. int m_OldSel;
  76. RECT GetRect(const RECT &);
  77. RECT GetRect();
  78. RECT GetListBoxRect();
  79. void SetRect();
  80. RECT m_rect;
  81. void InternalPaint(HDC hDC);
  82. void Notify(int code);
  83. CFlexListBox m_ListBox;
  84. BOOL m_bInSelMode;
  85. void DoSel();
  86. };
  87. CFlexComboBox *CreateFlexComboBox(FLEXCOMBOBOXCREATESTRUCT *pcs);
  88. #endif //__FLEXCOMBOBOX_H__