00001 /* 00002 * AiksaurusGTK - A GTK interface to the Aiksaurus library 00003 * Copyright (C) 2001 by Jared Davis 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00018 * 02111-1307, USA. 00019 */ 00020 00021 #ifndef INCLUDED_AIKSAURUS_GTK_REPLACEBAR_H 00022 #define INCLUDED_AIKSAURUS_GTK_REPLACEBAR_H 00023 00024 #include "ut_compiler.h" 00025 ABI_W_NO_CONST_QUAL 00026 #include <gtk/gtk.h> 00027 ABI_W_POP 00028 00029 namespace AiksaurusGTK_impl 00030 { 00031 00032 class DialogMediator; 00033 class Replacebar 00034 { 00035 private: 00036 DialogMediator& d_mediator; 00037 GtkWidget *d_replacebar_ptr; // layout hbox 00038 GtkWidget *d_replacewith_label_ptr; // says "Replace With" 00039 GtkWidget *d_replacebutton_hold_ptr; // for some padding 00040 GtkWidget *d_replacebutton_ptr; // replace button 00041 GtkWidget *d_cancelbutton_ptr; // cancel button 00042 GtkWidget *d_replacewith_ptr; // text entry 00043 00044 // GUI Callbacks. These will invoke the mediator as needed. 00045 // Note that these functions might throw just about anything. 00046 static void _cancelClicked(GtkWidget* w, gpointer data); 00047 static void _replaceClicked(GtkWidget* w, gpointer data); 00048 static void _keyPressed(GtkWidget* w, GdkEventKey* k, gpointer data); 00049 00050 public: 00051 00052 Replacebar(DialogMediator& mediator) throw(); 00053 00054 // Warning: You need to call gtk_widget_destroy on getReplacebar(), or 00055 // destroy whatever widget you put it in. The destructor will NOT free 00056 // up the memory used by the GUI widgets. 00057 ~Replacebar() throw(); 00058 00059 // getReplacebar(): return layout widget for replace bar. 00060 GtkWidget* getReplacebar() throw(); 00061 00062 // getText(): return current text of replace text field. 00063 const char* getText() const throw(); 00064 00065 // setText(): reset text of replace text field to something new. 00066 void setText(const char* str) throw(); 00067 }; 00068 00069 } 00070 00071 #endif // INCLUDED_AIKSAURUS_GTK_REPLACEBAR_H