1 // ePDFView - A lightweight PDF Viewer.
2 // Copyright (C) 2006, 2007, 2009 Emma's Software.
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 
18 #if !defined (__IFIND_VIEW_H__)
19 #define __IFIND_VIEW_H__
20 
21 namespace ePDFView
22 {
23     // Forward declarations.
24     class FindPter;
25 
26     ///
27     /// @class IFindView
28     /// @brief Interface for the find view.
29     ///
30     /// The find view is the view that will ask to the user the text to
31     /// find in the dialog and also the "find progress dialog", which
32     /// tells the user where is looking for at the moment.
33     ///
34     class IFindView
35     {
36         public:
37             ///
38             /// @brief Destroys all allocated memory for IFindView.
39             ///
~IFindView(void)40             virtual ~IFindView (void)
41             {
42             }
43 
44             ///
45             /// @brief Gets the view's presenter.
46             ///
47             /// @return The presenter that is controlling the view.
48             ///
getPresenter(void)49             FindPter *getPresenter (void)
50             {
51                 return m_Pter;
52             }
53 
54             ///
55             /// @brief Sets the view's presenter.
56             ///
57             /// After settings the presenter, the view can show the
58             /// find bar.
59             ///
60             /// @param pter The presenter that will control the view.
61             ///
setPresenter(FindPter * pter)62             virtual void setPresenter (FindPter *pter)
63             {
64                 m_Pter = pter;
65             }
66 
67             ///
68             /// @brief Gets the text to find.
69             ///
70             /// The view must get the text to find from the find dialog
71             /// and return it.
72             ///
73             /// @return The text to find entered by the user.
74             ///
75             virtual const gchar *getTextToFind (void) = 0;
76 
77             ///
78             /// @brief Hides the view.
79             ///
80             /// The view must be hidden when the presenter calls this member
81             /// and also the text of the find entry must be set to an empty
82             /// string.
83             ///
84             virtual void hide (void) = 0;
85 
86             ///
87             /// @brief Sensitives the Find Next button.
88             ///
89             /// @param sensitive TRUE to sensitive the button, FALSE
90             ///                  to insensitive it.
91             ///
92             virtual void sensitiveFindNext (gboolean sensitive) = 0;
93 
94             ///
95             /// @brief Sensitives the Find Next button.
96             ///
97             /// @param sensitive TRUE to sensitive the button, FALSE
98             ///                  to insensitive it.
99             ///
100             virtual void sensitiveFindPrevious (gboolean sensitive) = 0;
101 
102             ///
103             /// @brief Sets the information text.
104             ///
105             /// The view must set a label to the specified text to
106             /// show it to the user. The text to show is something like
107             /// "Searching on page %d of %d" or "Not Found!", etc...
108             ///
109             /// @param text The text to show.
110             ///
111             virtual void setInformationText (const gchar *text) = 0;
112 
113         protected:
114             /// The presenter that controls the view.
115             FindPter *m_Pter;
116 
117             ///
118             /// @brief Constructs a new IFindView object.
119             ///
IFindView(void)120             IFindView (void)
121             {
122                 m_Pter = NULL;
123             }
124     };
125 }
126 
127 #endif // !__IFIND_VIEW_H__
128