| 1 |
/* |
| 2 |
* AiksaurusGTK - A GTK interface to the Aiksaurus library |
| 3 |
* Copyright (C) 2001 by Jared Davis |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU General Public License |
| 7 |
* as published by the Free Software Foundation; either version 2 |
| 8 |
* of the License, or (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., 59 Temple Place - Suite 330, Boston, MA |
| 18 |
* 02111-1307, USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef INCLUDED_AIKSAURUS_GTK_REPLACEBAR_H |
| 22 |
#define INCLUDED_AIKSAURUS_GTK_REPLACEBAR_H |
| 23 |
|
| 24 |
#include <gtk/gtk.h> |
| 25 |
|
| 26 |
namespace AiksaurusGTK_impl |
| 27 |
{ |
| 28 |
|
| 29 |
class DialogMediator; |
| 30 |
class Replacebar |
| 31 |
{ |
| 32 |
private: |
| 33 |
DialogMediator& d_mediator; |
| 34 |
GtkWidget *d_replacebar_ptr; // layout hbox |
| 35 |
GtkWidget *d_replacewith_label_ptr; // says "Replace With" |
| 36 |
GtkWidget *d_replacebutton_hold_ptr; // for some padding |
| 37 |
GtkWidget *d_replacebutton_ptr; // replace button |
| 38 |
GtkWidget *d_cancelbutton_ptr; // cancel button |
| 39 |
GtkWidget *d_replacewith_ptr; // text entry |
| 40 |
|
| 41 |
// GUI Callbacks. These will invoke the mediator as needed. |
| 42 |
// Note that these functions might throw just about anything. |
| 43 |
static void _cancelClicked(GtkWidget* w, gpointer data); |
| 44 |
static void _replaceClicked(GtkWidget* w, gpointer data); |
| 45 |
static void _keyPressed(GtkWidget* w, GdkEventKey* k, gpointer data); |
| 46 |
|
| 47 |
public: |
| 48 |
|
| 49 |
Replacebar(DialogMediator& mediator) throw(); |
| 50 |
|
| 51 |
// Warning: You need to call gtk_widget_destroy on getReplacebar(), or |
| 52 |
// destroy whatever widget you put it in. The destructor will NOT free |
| 53 |
// up the memory used by the GUI widgets. |
| 54 |
~Replacebar() throw(); |
| 55 |
|
| 56 |
// getReplacebar(): return layout widget for replace bar. |
| 57 |
GtkWidget* getReplacebar() throw(); |
| 58 |
|
| 59 |
// getText(): return current text of replace text field. |
| 60 |
const char* getText() const throw(); |
| 61 |
|
| 62 |
// setText(): reset text of replace text field to something new. |
| 63 |
void setText(const char* str) throw(); |
| 64 |
}; |
| 65 |
|
| 66 |
} |
| 67 |
|
| 68 |
#endif // INCLUDED_AIKSAURUS_GTK_REPLACEBAR_H |