home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / listpm4.zip / source / search.cpp < prev    next >
C/C++ Source or Header  |  1998-04-22  |  3KB  |  91 lines

  1. /*
  2.     listPM list files under Presentation Manager. Uses Open Class Libarary.
  3.     Copyright (C) 1998  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.     11900 Metric Blvd #J-181
  21.     Austin Tx 78758-3117
  22.     pelliott@io.com
  23. */
  24. #include "search.hpp"
  25.  
  26. #include "listpm.h"
  27.  
  28. SearchInfo::SearchInfo(IWindow & owner , IHelpWindow & help) :
  29. // set up the parts.
  30. IFrameWindow( DLG_SEARCHFORTEXT , &owner,IFrameWindow::tryDialogResource ),
  31. search_text_field( ENT_TEXT ,this ),
  32. exact_box( BOX_CASE ,this ),
  33. forward( BUT_FORWARD, this ) ,
  34. reverse( BUT_REVERSE, this ) ,
  35. acc( DLG_SEARCHFORTEXT, this)
  36. {
  37.     // provide help for search dialog.
  38.     help.setAssociatedWindow( this );
  39.  
  40.      // set the focus to entry field.
  41.      search_text_field.setFocus();
  42.  
  43.      // select forward direction.
  44.      forward.select(true); reverse.select(false);
  45.  
  46.      forward.select();
  47.      forward.enableGroup();
  48.      forward.enableTabStop();
  49.  
  50.      reverse.enableTabStop();
  51.  
  52.      // disable this hidden dialog till it is requested.
  53.      disable();
  54.                                                // do not destroy on close.
  55.      setDestroyOnClose(false);                 // use dialog over and over.
  56.  
  57. };
  58.  
  59. Boolean SearchInfo::Exact(void)
  60. {                                              // exact case wanted
  61.      return exact_box.isSelected();
  62. };
  63. Boolean SearchInfo::DirectionForward(void)
  64. {                                              // forward direction selected.
  65.      return forward.isSelected();
  66. };
  67. SearchInfo::operator IString()
  68. {                                              // returns entry field text.
  69.      return search_text_field.text();
  70. };
  71. IString SearchInfo::GetToBeSearched(void)      // display the dialog.
  72. {
  73.      // highlight all the current content of entry field
  74.      search_text_field.selectRange();
  75.  
  76.      // endable the dialog.
  77.      enable();
  78.  
  79.      // set focus to entry field.
  80.      search_text_field.setFocus();
  81.  
  82.      // show dialog modally.
  83.      showModally();
  84.  
  85.      // hide and disable dialog again.
  86.      hide();
  87.      disable();
  88.  
  89.      return *this;
  90. };
  91.