home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2233.zip / wxOS2-2_3_3.zip / wxWindows-2.3.3 / src / common / choiccmn.cpp < prev    next >
C/C++ Source or Header  |  2002-01-07  |  2KB  |  73 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name:        common/choiccmn.cpp
  3. // Purpose:     common (to all ports) wxChoice functions
  4. // Author:      Vadim Zeitlin
  5. // Modified by:
  6. // Created:     26.07.99
  7. // RCS-ID:      $Id: choiccmn.cpp,v 1.8 2002/01/07 21:52:28 GD Exp $
  8. // Copyright:   (c) wxWindows team
  9. // Licence:     wxWindows license
  10. /////////////////////////////////////////////////////////////////////////////
  11.  
  12. // ============================================================================
  13. // declarations
  14. // ============================================================================
  15.  
  16. // ----------------------------------------------------------------------------
  17. // headers
  18. // ----------------------------------------------------------------------------
  19.  
  20. #ifdef __GNUG__
  21.     #pragma implementation "choicebase.h"
  22. #endif
  23.  
  24. // For compilers that support precompilation, includes "wx.h".
  25. #include "wx/wxprec.h"
  26.  
  27. #ifdef __BORLANDC__
  28.     #pragma hdrstop
  29. #endif
  30.  
  31. #if wxUSE_CHOICE
  32.  
  33. #ifndef WX_PRECOMP
  34.     #include "wx/choice.h"
  35. #endif
  36.  
  37. // ============================================================================
  38. // implementation
  39. // ============================================================================
  40.  
  41. wxChoiceBase::~wxChoiceBase()
  42. {
  43.     // this destructor is required for Darwin
  44. }
  45.  
  46. // ----------------------------------------------------------------------------
  47. // selection
  48. // ----------------------------------------------------------------------------
  49.  
  50. bool wxChoiceBase::SetStringSelection(const wxString& s)
  51. {
  52.     int sel = FindString(s);
  53.     wxCHECK_MSG( sel != -1, FALSE,
  54.                  wxT("invalid string in wxChoice::SetStringSelection") );
  55.  
  56.     Select(sel);
  57.  
  58.     return TRUE;
  59. }
  60.  
  61. // ----------------------------------------------------------------------------
  62. // misc
  63. // ----------------------------------------------------------------------------
  64.  
  65. void wxChoiceBase::Command(wxCommandEvent& event)
  66. {
  67.     SetSelection(event.m_commandInt);
  68.     (void)ProcessEvent(event);
  69. }
  70.  
  71. #endif // wxUSE_CHOICE
  72.  
  73.