vdk 2.4.0
entry.h
00001 /*
00002  * ===========================
00003  * VDK Visual Develeopment Kit
00004  * Version 0.4
00005  * October 1998
00006  * ===========================
00007  *
00008  * Copyright (C) 1998, Mario Motta
00009  * Developed by Mario Motta <mmotta@guest.net>
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Library General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2 of the License, or (at your option) any later version.
00015  *
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Library General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Library General Public
00022  * License along with this library; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00024  * 02111-1307, USA.
00025  */
00026 
00027 #ifndef  ENTRY_H
00028 #define  ENTRY_H
00029 
00030 #include <vdk/vdkobj.h>
00031 #include <vdk/vdkprops.h>
00032 #include <vdk/vdkstring.h>
00033 //#include <string.h>
00034 
00046 class VDKEntry: public VDKObject
00047 {
00048   static int FocusOutEvent(GtkWidget *w,
00049                             GdkEventFocus *event,
00050                             gpointer wid);
00051   static int FocusInEvent(GtkWidget *w,
00052                             GdkEventFocus *event,
00053                             gpointer wid);
00054   VDKString buffer;
00055  protected:
00056   int changeConnect;
00057   VDKObjectSignal s_activated, s_changed;
00058 public:
00059   // properties
00069   VDKReadWriteValueProp<VDKEntry,char*> Text;
00073   VDKReadWriteValueProp<VDKEntry,bool>  Editable;
00079   VDKReadWriteValueProp<VDKEntry,bool>  Hidden;
00080   //
00081   VDKEntry(VDKForm* owner,int maxLen = 0, char* def = (char*) NULL);
00082 
00083   virtual ~VDKEntry();
00088   void SetCompletion(char** completion_list);
00093   void AddCompletionItem(char* completion_item);
00098   void RemoveCompletionItem(char* completion_item);
00099   /*
00100    */
00101   void SetText(char* text);
00102   char* GetText(); 
00103   void SetEditable(bool flag)
00104     { gtk_entry_set_editable(GTK_ENTRY(widget),flag); }
00105   bool GetEditable() { return Editable; }
00106   virtual void SetBackground(VDKRgb rgb, GtkStateType state);
00107   virtual void SetForeground(VDKRgb rgb, GtkStateType state);
00108   virtual void SetFont(VDKFont* font);
00109   void SetHidden(bool flag)
00110     { gtk_entry_set_visibility(GTK_ENTRY(widget), ! flag) ; }
00111   bool GetHidden()
00112     { return ! Hidden; }
00113 };
00114 #endif