libyui-ncurses-pkg  2.48.5.2
NCPkgFilterSearch.h
1 /****************************************************************************
2 |
3 | Copyright (c) [2002-2011] Novell, Inc.
4 | All Rights Reserved.
5 |
6 | This program is free software; you can redistribute it and/or
7 | modify it under the terms of version 2 of the GNU General Public License as
8 | published by the Free Software Foundation.
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, contact Novell, Inc.
17 |
18 | To contact Novell about this file by physical or electronic mail,
19 | you may find current contact information at www.novell.com
20 |
21 |***************************************************************************/
22 
23 
24 /*---------------------------------------------------------------------\
25 | |
26 | __ __ ____ _____ ____ |
27 | \ \ / /_ _/ ___|_ _|___ \ |
28 | \ V / _` \___ \ | | __) | |
29 | | | (_| |___) || | / __/ |
30 | |_|\__,_|____/ |_| |_____| |
31 | |
32 | core system |
33 | (C) SuSE GmbH |
34 \----------------------------------------------------------------------/
35 
36  File: NCPkgFilterSearch.h
37 
38  Author: Gabriele Strattner <gs@suse.de>
39 
40 /-*/
41 #ifndef NCPkgFilterSearch_h
42 #define NCPkgFilterSearch_h
43 
44 #include <iosfwd>
45 
46 #include <vector>
47 #include <string>
48 #include <set>
49 
50 #include "NCPopup.h"
51 #include "NCInputField.h"
52 #include "NCLabel.h"
53 #include "NCLayoutBox.h"
54 #include "NCRichText.h"
55 #include "NCCheckBox.h"
56 #include "NCComboBox.h"
57 #include "NCPushButton.h"
58 
59 class NCPackageSelector;
60 
61 ///////////////////////////////////////////////////////////////////
62 //
63 // CLASS NAME : NCPkgFilterSearch
64 //
65 // DESCRIPTION :
66 //
67 class NCPkgFilterSearch : public NCLayoutBox {
68 
69  NCPkgFilterSearch & operator=( const NCPkgFilterSearch & );
71 
72 private:
73 
74  enum SearchMode {
75  Contains = 0,
76  BeginsWith,
77  ExactMatch,
78  UseWildcard,
79  UseRegexp
80  };
81 
82  NCInputField * searchExpr;
83  NCCheckBox * ignoreCase;
84  NCComboBox * searchMode;
85 
86  NCPackageSelector * packager; // connection to the package selector
87 
88  bool getCheckBoxValue( NCCheckBox * checkBox );
89 
90 protected:
91 
92  std::string getSearchExpression() const;
93 
94 public:
95 
96  NCPkgFilterSearch( YWidget *parent, YUIDimension dim, NCPackageSelector *pkger );
97  virtual ~NCPkgFilterSearch();
98 
99  void createLayout( YWidget *parent );
100 
101  virtual bool showSearchResultPackages();
102 
103  bool match ( std::string s1, std::string s2, bool ignoreCase );
104 
105  bool fillSearchList( std::string & expr, bool ignoreCase );
106 
107  NCInputField * getSearchField() { return searchExpr; }
108 
109 };
110 
111 ///////////////////////////////////////////////////////////////////
112 
113 
114 #endif // NCPkgFilterSearch_h