BitmapPickerCombo.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //----------------------------------------------------------------------------
  2. // N O L D U S I N F O R M A T I O N T E C H N O L O G Y B . V .
  3. //----------------------------------------------------------------------------
  4. // Filename: BitmapPickerCombo.h
  5. // Project: EthoVision
  6. // Module: BitmapPicker
  7. // Programmer: Anneke Sicherer-Roetman
  8. // Version: 1.00
  9. // Revision Date: 06-10-1999
  10. //----------------------------------------------------------------------------
  11. // Description: Declaration of class CBitmapPickerCombo
  12. //----------------------------------------------------------------------------
  13. // Revision history:
  14. // 06-10-1999 - First implementation
  15. //----------------------------------------------------------------------------
  16. // Bugs: ........
  17. //----------------------------------------------------------------------------
  18. // @doc
  19. //----------------------------------------------------------------------------
  20. #if !defined(AFX_CBITMAPPICKERCOMBO_H__8AAE34F7_7B02_11D3_A615_0060085FE616__INCLUDED_)
  21. #define AFX_CBITMAPPICKERCOMBO_H__8AAE34F7_7B02_11D3_A615_0060085FE616__INCLUDED_
  22. #if _MSC_VER > 1000
  23. #pragma once
  24. #endif // _MSC_VER > 1000
  25. //----------------------------------------------------------------------------
  26. // @class CBitmapPickerCombo |
  27. // combobox to select bitmaps from
  28. // @base public | CComboBox
  29. //----------------------------------------------------------------------------
  30. // @prog
  31. // Anneke Sicherer-Roetman <nl>
  32. // after: Icon Picker Combo Box by Joel Wahlberg <nl>
  33. // http://www.codeguru.com/combobox/icon_combobox.shtml
  34. // @revs
  35. // 06-10-1999 - First implementation
  36. //----------------------------------------------------------------------------
  37. // @ex Here's how to use this control in a dialog |
  38. // 1. Include CBitmapPickerCombo.cpp and CBitmapPickerCombo.h in your project
  39. // 2. In the resource editor create a regular combobox with at least the
  40. // following styles: DropList, OwnerDraw Variable, Has Strings
  41. // 3. Create a control member variable for the combobox in VC's classwizard
  42. // 4. Replace CComboBox with CBitmapPickerCombo in your dialog's .h file
  43. // 5. In OnInitDialog use the AddBitmap or InsertBitmap member functions
  44. // to add bitmaps (and strings) to the combobox
  45. //----------------------------------------------------------------------------
  46. // @todo
  47. //----------------------------------------------------------------------------
  48. class CBitmapPickerCombo : public CComboBox
  49. {
  50. // @access Public Member Functions and Variables
  51. public:
  52. // @cmember
  53. // constructor
  54. CBitmapPickerCombo();
  55. // @cmember,mfunc
  56. // destructor
  57. virtual ~CBitmapPickerCombo() {}
  58. // @cmember
  59. // adds bitmap (and string) item to combobox
  60. int AddBitmap(const CBitmap *bitmap, const char *string = NULL);
  61. // @cmember
  62. // adds bitmap (and string) item to combobox at specified index
  63. int InsertBitmap(int nIndex, const CBitmap *bitmap, const char *string = NULL);
  64. // @access Protected Member Functions and Variables
  65. protected:
  66. // @cmember
  67. // Called by MFC when visual aspect of combo box changes
  68. virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
  69. // @cmember
  70. // Called by MFC when combo box is created
  71. virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMIS);
  72. // @cmember,mfunc
  73. // strings cannot be added
  74. virtual int AddString(LPCTSTR lpszString) { return -1; }
  75. // @cmember,mfunc
  76. // strings cannot be added
  77. virtual int InsertString(int nIndex, LPCTSTR lpszString) { return -1; }
  78. // @cmember,mfunc
  79. // strings cannot be deleted
  80. virtual int DeleteString(int nIndex) { return -1; }
  81. #ifdef _DEBUG
  82. // @cmember,mfunc
  83. // for assertion only
  84. virtual void PreSubclassWindow();
  85. #endif
  86. // @access Private Member Functions and Variables
  87. private:
  88. int m_nItemWidth, m_nItemHeight; // @cmember size of items
  89. // @cmember
  90. // draws bitmap (and string) in item
  91. void OutputBitmap(LPDRAWITEMSTRUCT lpDIS, bool selected);
  92. // @cmember
  93. // sets overall item size
  94. void SetSize(int width, int height);
  95. };
  96. //{{AFX_INSERT_LOCATION}}
  97. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  98. #endif // !defined(AFX_CBITMAPPICKERCOMBO_H__8AAE34F7_7B02_11D3_A615_0060085FE616__INCLUDED_)