home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / listpm3.zip / source / sav / search.cpp next >
C/C++ Source or Header  |  1996-06-28  |  3KB  |  90 lines

  1. /*
  2.     listPM list files under Presentation Manager. Uses Open Class Libarary.
  3.     Copyright (C) 1996  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.     3987 South Gessner #224
  21.     Houston Tx 77063
  22.     Paul.Elliott@Hrnowl.LoneStar.Org
  23. */
  24. #include "search.hpp"
  25.  
  26. #include "listpm.h"
  27.  
  28.  
  29. SearchInfo::SearchInfo(IWindow & owner) :
  30. IFrameWindow( DLG_SEARCHFORTEXT , &owner,IFrameWindow::tryDialogResource ),
  31. canvas(CAN_MAIN,this,this),
  32. search_text_field( ENT_TEXT ,&canvas , &canvas ),
  33. horz_canvas( CAN_HOR ,&canvas,&canvas),
  34. exact_box( BOX_CASE ,&horz_canvas, &horz_canvas),
  35. vert_canvas( CAN_VERT, &horz_canvas, &horz_canvas ),
  36. forward( BUT_FORWARD, &vert_canvas, &vert_canvas) ,
  37. reverse( BUT_REVERSE, &vert_canvas, &vert_canvas )
  38. {
  39.      cmd_hand.handleEventsFor(this);
  40.      setClient(&canvas);
  41.      canvas.setDeckOrientation(ISetCanvas::vertical);
  42.  
  43.      search_text_field.setFocus();
  44.  
  45.      search_text_field.setText(STR_ENTRYTITLE);
  46.  
  47.      horz_canvas.setDeckOrientation(ISetCanvas::horizontal);
  48.  
  49.      vert_canvas.setDeckOrientation( ISetCanvas::vertical );
  50.  
  51.      forward.select(true); reverse.select(false);
  52.  
  53.      exact_box.setText(STR_EXACTCASE);
  54.      forward.setText(STR_FORWARD);
  55.      reverse.setText(STR_REVERSE);
  56.  
  57.      disable();
  58.                                                // do not destroy on close.
  59.      setDestroyOnClose(false);                 // use dialog over and over.
  60.  
  61. };
  62. Boolean SearchInfo::Exact(void)
  63. {
  64.      return exact_box.isSelected();
  65. };
  66. Boolean SearchInfo::DirectionForward(void)
  67. {
  68.      return forward.isSelected();
  69. };
  70. SearchInfo::operator IString()
  71. {
  72.      return search_text_field.text();
  73. };
  74. IString SearchInfo::GetToBeSearched(void)
  75. {
  76.      search_text_field.selectRange();
  77.      enable();
  78.      showModally();
  79.      hide();
  80.      disable();
  81.  
  82.      return *this;
  83. };
  84. Boolean SearchInfo::SearchCommand::command(ICommandEvent& event)
  85. {
  86.      if ( event.eventId() ==  ENT_TEXT )
  87.         ( (IFrameWindow*) event.dispatchingWindow()) -> dismiss();
  88.      return false;
  89. };
  90.