home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / listpm7.zip / search.hpp < prev    next >
C/C++ Source or Header  |  1999-06-28  |  4KB  |  100 lines

  1. /*
  2.     listPM list files under Presentation Manager. Uses Open Class Libarary.
  3.     Copyright (C) 1998, 1999  Paul Elliott
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.     Paul Elliott
  20.     PMB #181
  21.     11900 Metric Blvd Ste. J
  22.     Austin Tx 78758-3117
  23.     pelliott@io.com
  24. */
  25. #ifndef SEARCH
  26. #define SEARCH
  27. #include <iframe.hpp>
  28.  
  29. #include <ientryfd.hpp>
  30. #include <icheckbx.hpp>
  31. #include <iradiobt.hpp>
  32. #include <istring.hpp>
  33. #include <iaccel.hpp>
  34. #include <ihelp.hpp>
  35. #include <ihelphdr.hpp>
  36. #include <ifocshdr.hpp>
  37. #include <icmdhdr.hpp>
  38.  
  39. /*
  40.  * this is a dialog which gets text to search for,
  41.  * direction of search =( forward or reverse )
  42.  * and exact case search.
  43.  */
  44. class SearchInfo : public IFrameWindow
  45. {
  46.       private:
  47.  
  48.                   // focus handler  , commands, when we get focus, set focus to
  49.                   // the text field
  50.                   class FocusHand : public IFocusHandler , public ICommandHandler
  51.                   {
  52.                      private:
  53.                         SearchInfo & si;                               //ref to the SearchInfo we service.
  54.                      public:
  55.                         // constructor saves the SearchInfor we service and handles events for.
  56.                         FocusHand( SearchInfo& si) : si(si)
  57.                         {
  58.                            IFocusHandler::handleEventsFor( &si );
  59.                            ICommandHandler::handleEventsFor( &si );
  60.                         };
  61.                         // called when SearchInfo gets focus
  62.                         virtual bool gotFocus( IControlEvent& ce);
  63.                         // looks at ICommandEvent s scans for GOTFOCUS.
  64.                         virtual bool command( ICommandEvent& ce );
  65.                   } fcshand;                                         // this is a local class
  66.                   friend class FocusHand;                            // can access private parts of SearchInfo we service.
  67.  
  68.                   // search text entry field.
  69.                   IEntryField      search_text_field;
  70.  
  71.                   // check box specifies exact case.
  72.                   ICheckBox        exact_box;
  73.  
  74.                   // forward,reverse radio buttons.
  75.                   IRadioButton     forward,reverse;
  76.  
  77.                   // key board accelerator.
  78.  
  79.                   IAccelerator     acc;
  80.  
  81.       public:
  82.  
  83.                   // construct from owner. and its help window.
  84.                   SearchInfo(IWindow & owner , IHelpWindow& help);
  85.  
  86.                   // returns exact case requested.
  87.                   Boolean Exact(void);
  88.  
  89.                   // true if foward direction wanted.
  90.                   Boolean DirectionForward(void);
  91.  
  92.                   // returns string to searched for.
  93.                   operator IString();
  94.  
  95.                   // run dialog till user closes.
  96.                   IString GetToBeSearched(void);
  97.  
  98. };
  99. #endif // SEARCH
  100.