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.

70 lines
1.9 KiB

  1. // Combobox.h
  2. //
  3. #ifndef DUI_CONTROL_COMBOBOX_H_INCLUDED
  4. #define DUI_CONTROL_COMBOBOX_H_INCLUDED
  5. #include "duihwndhost.h"
  6. namespace DirectUI
  7. {
  8. ////////////////////////////////////////////////////////
  9. // Combobox
  10. // SelectionChange event
  11. struct SelectionIndexChangeEvent : Event
  12. {
  13. int iOld;
  14. int iNew;
  15. };
  16. // Class definition
  17. class Combobox : public HWNDHost
  18. {
  19. public:
  20. static HRESULT Create(OUT Element** ppElement) { return Create(AE_MouseAndKeyboard, ppElement); }
  21. static HRESULT Create(UINT nActive, OUT Element** ppElement);
  22. // System events
  23. virtual void OnInput(InputEvent* pie);
  24. virtual void OnPropertyChanged(PropertyInfo* ppi, int iIndex, Value* pvOld, Value* pvNew);
  25. // Control notifications
  26. virtual bool OnNotify(UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT* plRet);
  27. // Sizing callback
  28. virtual BOOL OnAdjustWindowSize(int x, int y, UINT uFlags);
  29. // Rendering
  30. SIZE GetContentSize(int dConstW, int dConstH, Surface* psrf);
  31. // ClassInfo accessors (static and virtual instance-based)
  32. static IClassInfo* Class;
  33. virtual IClassInfo* GetClassInfo() { return Class; }
  34. static HRESULT Register();
  35. int AddString(LPCWSTR lpszString);
  36. // Event types
  37. static UID SelectionChange;
  38. // Property definitions
  39. static PropertyInfo* SelectionProp;
  40. // Quick property accessors
  41. int GetSelection() DUIQuickGetter(int, GetInt(), Selection, Specified)
  42. HRESULT SetSelection(int v) DUIQuickSetter(CreateInt(v), Selection)
  43. Combobox() { }
  44. virtual ~Combobox() { }
  45. HRESULT Initialize(UINT nActive) { return HWNDHost::Initialize(HHC_CacheFont | HHC_SyncText | HHC_SyncPaint, nActive); }
  46. virtual HWND CreateHWND(HWND hwndParent);
  47. };
  48. } // namespace DirectUI
  49. #endif // DUI_CONTROL_COMBOBOX_H_INCLUDED