wx/gtk/stattext.h \
wx/gtk/tbargtk.h \
wx/gtk/textctrl.h \
+ wx/gtk/textentry.h \
wx/gtk/tglbtn.h \
wx/gtk/treectrl.h \
wx/gtk/treeentry_gtk.h
wx/statusbr.h \
wx/textctrl.h \
wx/textdlg.h \
+ wx/textentry.h \
wx/toolbar.h \
wx/validate.h \
wx/valtext.h \
monodll_stockitem.o \
monodll_tbarbase.o \
monodll_textcmn.o \
+ monodll_textentrycmn.o \
monodll_toplvcmn.o \
monodll_treebase.o \
monodll_valgen.o \
monodll_stockitem.o \
monodll_tbarbase.o \
monodll_textcmn.o \
+ monodll_textentrycmn.o \
monodll_toplvcmn.o \
monodll_treebase.o \
monodll_valgen.o \
monodll_stattext.o \
monodll_tbargtk.o \
monodll_textctrl.o \
+ monodll_textentry.o \
monodll_tglbtn.o \
monodll_treeentry_gtk.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS)
monolib_stockitem.o \
monolib_tbarbase.o \
monolib_textcmn.o \
+ monolib_textentrycmn.o \
monolib_toplvcmn.o \
monolib_treebase.o \
monolib_valgen.o \
monolib_stockitem.o \
monolib_tbarbase.o \
monolib_textcmn.o \
+ monolib_textentrycmn.o \
monolib_toplvcmn.o \
monolib_treebase.o \
monolib_valgen.o \
monolib_stattext.o \
monolib_tbargtk.o \
monolib_textctrl.o \
+ monolib_textentry.o \
monolib_tglbtn.o \
monolib_treeentry_gtk.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_1)
coredll_stockitem.o \
coredll_tbarbase.o \
coredll_textcmn.o \
+ coredll_textentrycmn.o \
coredll_toplvcmn.o \
coredll_treebase.o \
coredll_valgen.o \
coredll_stockitem.o \
coredll_tbarbase.o \
coredll_textcmn.o \
+ coredll_textentrycmn.o \
coredll_toplvcmn.o \
coredll_treebase.o \
coredll_valgen.o \
coredll_stattext.o \
coredll_tbargtk.o \
coredll_textctrl.o \
+ coredll_textentry.o \
coredll_tglbtn.o \
coredll_treeentry_gtk.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_2)
corelib_stockitem.o \
corelib_tbarbase.o \
corelib_textcmn.o \
+ corelib_textentrycmn.o \
corelib_toplvcmn.o \
corelib_treebase.o \
corelib_valgen.o \
corelib_stockitem.o \
corelib_tbarbase.o \
corelib_textcmn.o \
+ corelib_textentrycmn.o \
corelib_toplvcmn.o \
corelib_treebase.o \
corelib_valgen.o \
corelib_stattext.o \
corelib_tbargtk.o \
corelib_textctrl.o \
+ corelib_textentry.o \
corelib_tglbtn.o \
corelib_treeentry_gtk.o
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_3)
monodll_gvfs.o: $(srcdir)/src/gtk/gnome/gvfs.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/gnome/gvfs.cpp
+monodll_textentry.o: $(srcdir)/src/gtk/textentry.cpp $(MONODLL_ODEP)
+ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/textentry.cpp
+
monodll_treeentry_gtk.o: $(srcdir)/src/gtk/treeentry_gtk.c $(MONODLL_ODEP)
$(CCC) -c -o $@ $(MONODLL_CFLAGS) $(srcdir)/src/gtk/treeentry_gtk.c
@COND_USE_GUI_1@monodll_textcmn.o: $(srcdir)/src/common/textcmn.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/textcmn.cpp
+@COND_USE_GUI_1@monodll_textentrycmn.o: $(srcdir)/src/common/textentrycmn.cpp $(MONODLL_ODEP)
+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/textentrycmn.cpp
+
@COND_USE_GUI_1@monodll_toplvcmn.o: $(srcdir)/src/common/toplvcmn.cpp $(MONODLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/toplvcmn.cpp
monolib_gvfs.o: $(srcdir)/src/gtk/gnome/gvfs.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/gnome/gvfs.cpp
+monolib_textentry.o: $(srcdir)/src/gtk/textentry.cpp $(MONOLIB_ODEP)
+ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/textentry.cpp
+
monolib_treeentry_gtk.o: $(srcdir)/src/gtk/treeentry_gtk.c $(MONOLIB_ODEP)
$(CCC) -c -o $@ $(MONOLIB_CFLAGS) $(srcdir)/src/gtk/treeentry_gtk.c
@COND_USE_GUI_1@monolib_textcmn.o: $(srcdir)/src/common/textcmn.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/textcmn.cpp
+@COND_USE_GUI_1@monolib_textentrycmn.o: $(srcdir)/src/common/textentrycmn.cpp $(MONOLIB_ODEP)
+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/textentrycmn.cpp
+
@COND_USE_GUI_1@monolib_toplvcmn.o: $(srcdir)/src/common/toplvcmn.cpp $(MONOLIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/toplvcmn.cpp
coredll_gvfs.o: $(srcdir)/src/gtk/gnome/gvfs.cpp $(COREDLL_ODEP)
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/gnome/gvfs.cpp
+coredll_textentry.o: $(srcdir)/src/gtk/textentry.cpp $(COREDLL_ODEP)
+ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/textentry.cpp
+
coredll_treeentry_gtk.o: $(srcdir)/src/gtk/treeentry_gtk.c $(COREDLL_ODEP)
$(CCC) -c -o $@ $(COREDLL_CFLAGS) $(srcdir)/src/gtk/treeentry_gtk.c
@COND_USE_GUI_1@coredll_textcmn.o: $(srcdir)/src/common/textcmn.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/textcmn.cpp
+@COND_USE_GUI_1@coredll_textentrycmn.o: $(srcdir)/src/common/textentrycmn.cpp $(COREDLL_ODEP)
+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/textentrycmn.cpp
+
@COND_USE_GUI_1@coredll_toplvcmn.o: $(srcdir)/src/common/toplvcmn.cpp $(COREDLL_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/toplvcmn.cpp
corelib_gvfs.o: $(srcdir)/src/gtk/gnome/gvfs.cpp $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/gnome/gvfs.cpp
+corelib_textentry.o: $(srcdir)/src/gtk/textentry.cpp $(CORELIB_ODEP)
+ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/textentry.cpp
+
corelib_treeentry_gtk.o: $(srcdir)/src/gtk/treeentry_gtk.c $(CORELIB_ODEP)
$(CCC) -c -o $@ $(CORELIB_CFLAGS) $(srcdir)/src/gtk/treeentry_gtk.c
@COND_USE_GUI_1@corelib_textcmn.o: $(srcdir)/src/common/textcmn.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/textcmn.cpp
+@COND_USE_GUI_1@corelib_textentrycmn.o: $(srcdir)/src/common/textentrycmn.cpp $(CORELIB_ODEP)
+@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/textentrycmn.cpp
+
@COND_USE_GUI_1@corelib_toplvcmn.o: $(srcdir)/src/common/toplvcmn.cpp $(CORELIB_ODEP)
@COND_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/toplvcmn.cpp
src/common/stockitem.cpp
src/common/tbarbase.cpp
src/common/textcmn.cpp
+ src/common/textentrycmn.cpp
src/common/toplvcmn.cpp
src/common/treebase.cpp
src/common/valgen.cpp
wx/statusbr.h
wx/textctrl.h
wx/textdlg.h
+ wx/textentry.h
wx/toolbar.h
wx/validate.h
wx/valtext.h
src/gtk/stattext.cpp
src/gtk/tbargtk.cpp
src/gtk/textctrl.cpp
+ src/gtk/textentry.cpp
src/gtk/tglbtn.cpp
src/gtk/treeentry_gtk.c
</set>
wx/gtk/stattext.h
wx/gtk/tbargtk.h
wx/gtk/textctrl.h
+ wx/gtk/textentry.h
wx/gtk/tglbtn.h
wx/gtk/treectrl.h
wx/gtk/treeentry_gtk.h
$(OBJS)\monodll_stockitem.obj \
$(OBJS)\monodll_tbarbase.obj \
$(OBJS)\monodll_textcmn.obj \
+ $(OBJS)\monodll_textentrycmn.obj \
$(OBJS)\monodll_toplvcmn.obj \
$(OBJS)\monodll_treebase.obj \
$(OBJS)\monodll_valgen.obj \
$(OBJS)\monodll_stockitem.obj \
$(OBJS)\monodll_tbarbase.obj \
$(OBJS)\monodll_textcmn.obj \
+ $(OBJS)\monodll_textentrycmn.obj \
$(OBJS)\monodll_toplvcmn.obj \
$(OBJS)\monodll_treebase.obj \
$(OBJS)\monodll_valgen.obj \
$(OBJS)\monolib_stockitem.obj \
$(OBJS)\monolib_tbarbase.obj \
$(OBJS)\monolib_textcmn.obj \
+ $(OBJS)\monolib_textentrycmn.obj \
$(OBJS)\monolib_toplvcmn.obj \
$(OBJS)\monolib_treebase.obj \
$(OBJS)\monolib_valgen.obj \
$(OBJS)\monolib_stockitem.obj \
$(OBJS)\monolib_tbarbase.obj \
$(OBJS)\monolib_textcmn.obj \
+ $(OBJS)\monolib_textentrycmn.obj \
$(OBJS)\monolib_toplvcmn.obj \
$(OBJS)\monolib_treebase.obj \
$(OBJS)\monolib_valgen.obj \
$(OBJS)\coredll_stockitem.obj \
$(OBJS)\coredll_tbarbase.obj \
$(OBJS)\coredll_textcmn.obj \
+ $(OBJS)\coredll_textentrycmn.obj \
$(OBJS)\coredll_toplvcmn.obj \
$(OBJS)\coredll_treebase.obj \
$(OBJS)\coredll_valgen.obj \
$(OBJS)\coredll_stockitem.obj \
$(OBJS)\coredll_tbarbase.obj \
$(OBJS)\coredll_textcmn.obj \
+ $(OBJS)\coredll_textentrycmn.obj \
$(OBJS)\coredll_toplvcmn.obj \
$(OBJS)\coredll_treebase.obj \
$(OBJS)\coredll_valgen.obj \
$(OBJS)\corelib_stockitem.obj \
$(OBJS)\corelib_tbarbase.obj \
$(OBJS)\corelib_textcmn.obj \
+ $(OBJS)\corelib_textentrycmn.obj \
$(OBJS)\corelib_toplvcmn.obj \
$(OBJS)\corelib_treebase.obj \
$(OBJS)\corelib_valgen.obj \
$(OBJS)\corelib_stockitem.obj \
$(OBJS)\corelib_tbarbase.obj \
$(OBJS)\corelib_textcmn.obj \
+ $(OBJS)\corelib_textentrycmn.obj \
$(OBJS)\corelib_toplvcmn.obj \
$(OBJS)\corelib_treebase.obj \
$(OBJS)\corelib_valgen.obj \
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_textentrycmn.obj: ..\..\src\common\textentrycmn.cpp
+ $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_toplvcmn.obj: ..\..\src\common\toplvcmn.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_textentrycmn.obj: ..\..\src\common\textentrycmn.cpp
+ $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_toplvcmn.obj: ..\..\src\common\toplvcmn.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_textentrycmn.obj: ..\..\src\common\textentrycmn.cpp
+ $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_toplvcmn.obj: ..\..\src\common\toplvcmn.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_textentrycmn.obj: ..\..\src\common\textentrycmn.cpp
+ $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_toplvcmn.obj: ..\..\src\common\toplvcmn.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
$(OBJS)\monodll_stockitem.o \
$(OBJS)\monodll_tbarbase.o \
$(OBJS)\monodll_textcmn.o \
+ $(OBJS)\monodll_textentrycmn.o \
$(OBJS)\monodll_toplvcmn.o \
$(OBJS)\monodll_treebase.o \
$(OBJS)\monodll_valgen.o \
$(OBJS)\monodll_stockitem.o \
$(OBJS)\monodll_tbarbase.o \
$(OBJS)\monodll_textcmn.o \
+ $(OBJS)\monodll_textentrycmn.o \
$(OBJS)\monodll_toplvcmn.o \
$(OBJS)\monodll_treebase.o \
$(OBJS)\monodll_valgen.o \
$(OBJS)\monolib_stockitem.o \
$(OBJS)\monolib_tbarbase.o \
$(OBJS)\monolib_textcmn.o \
+ $(OBJS)\monolib_textentrycmn.o \
$(OBJS)\monolib_toplvcmn.o \
$(OBJS)\monolib_treebase.o \
$(OBJS)\monolib_valgen.o \
$(OBJS)\monolib_stockitem.o \
$(OBJS)\monolib_tbarbase.o \
$(OBJS)\monolib_textcmn.o \
+ $(OBJS)\monolib_textentrycmn.o \
$(OBJS)\monolib_toplvcmn.o \
$(OBJS)\monolib_treebase.o \
$(OBJS)\monolib_valgen.o \
$(OBJS)\coredll_stockitem.o \
$(OBJS)\coredll_tbarbase.o \
$(OBJS)\coredll_textcmn.o \
+ $(OBJS)\coredll_textentrycmn.o \
$(OBJS)\coredll_toplvcmn.o \
$(OBJS)\coredll_treebase.o \
$(OBJS)\coredll_valgen.o \
$(OBJS)\coredll_stockitem.o \
$(OBJS)\coredll_tbarbase.o \
$(OBJS)\coredll_textcmn.o \
+ $(OBJS)\coredll_textentrycmn.o \
$(OBJS)\coredll_toplvcmn.o \
$(OBJS)\coredll_treebase.o \
$(OBJS)\coredll_valgen.o \
$(OBJS)\corelib_stockitem.o \
$(OBJS)\corelib_tbarbase.o \
$(OBJS)\corelib_textcmn.o \
+ $(OBJS)\corelib_textentrycmn.o \
$(OBJS)\corelib_toplvcmn.o \
$(OBJS)\corelib_treebase.o \
$(OBJS)\corelib_valgen.o \
$(OBJS)\corelib_stockitem.o \
$(OBJS)\corelib_tbarbase.o \
$(OBJS)\corelib_textcmn.o \
+ $(OBJS)\corelib_textentrycmn.o \
$(OBJS)\corelib_toplvcmn.o \
$(OBJS)\corelib_treebase.o \
$(OBJS)\corelib_valgen.o \
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\monodll_textentrycmn.o: ../../src/common/textentrycmn.cpp
+ $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\monodll_toplvcmn.o: ../../src/common/toplvcmn.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\monolib_textentrycmn.o: ../../src/common/textentrycmn.cpp
+ $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\monolib_toplvcmn.o: ../../src/common/toplvcmn.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\coredll_textentrycmn.o: ../../src/common/textentrycmn.cpp
+ $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\coredll_toplvcmn.o: ../../src/common/toplvcmn.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
endif
+ifeq ($(USE_GUI),1)
+$(OBJS)\corelib_textentrycmn.o: ../../src/common/textentrycmn.cpp
+ $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
ifeq ($(USE_GUI),1)
$(OBJS)\corelib_toplvcmn.o: ../../src/common/toplvcmn.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_stockitem.obj \
$(OBJS)\monodll_tbarbase.obj \
$(OBJS)\monodll_textcmn.obj \
+ $(OBJS)\monodll_textentrycmn.obj \
$(OBJS)\monodll_toplvcmn.obj \
$(OBJS)\monodll_treebase.obj \
$(OBJS)\monodll_valgen.obj \
$(OBJS)\monodll_stockitem.obj \
$(OBJS)\monodll_tbarbase.obj \
$(OBJS)\monodll_textcmn.obj \
+ $(OBJS)\monodll_textentrycmn.obj \
$(OBJS)\monodll_toplvcmn.obj \
$(OBJS)\monodll_treebase.obj \
$(OBJS)\monodll_valgen.obj \
$(OBJS)\monolib_stockitem.obj \
$(OBJS)\monolib_tbarbase.obj \
$(OBJS)\monolib_textcmn.obj \
+ $(OBJS)\monolib_textentrycmn.obj \
$(OBJS)\monolib_toplvcmn.obj \
$(OBJS)\monolib_treebase.obj \
$(OBJS)\monolib_valgen.obj \
$(OBJS)\monolib_stockitem.obj \
$(OBJS)\monolib_tbarbase.obj \
$(OBJS)\monolib_textcmn.obj \
+ $(OBJS)\monolib_textentrycmn.obj \
$(OBJS)\monolib_toplvcmn.obj \
$(OBJS)\monolib_treebase.obj \
$(OBJS)\monolib_valgen.obj \
$(OBJS)\coredll_stockitem.obj \
$(OBJS)\coredll_tbarbase.obj \
$(OBJS)\coredll_textcmn.obj \
+ $(OBJS)\coredll_textentrycmn.obj \
$(OBJS)\coredll_toplvcmn.obj \
$(OBJS)\coredll_treebase.obj \
$(OBJS)\coredll_valgen.obj \
$(OBJS)\coredll_stockitem.obj \
$(OBJS)\coredll_tbarbase.obj \
$(OBJS)\coredll_textcmn.obj \
+ $(OBJS)\coredll_textentrycmn.obj \
$(OBJS)\coredll_toplvcmn.obj \
$(OBJS)\coredll_treebase.obj \
$(OBJS)\coredll_valgen.obj \
$(OBJS)\corelib_stockitem.obj \
$(OBJS)\corelib_tbarbase.obj \
$(OBJS)\corelib_textcmn.obj \
+ $(OBJS)\corelib_textentrycmn.obj \
$(OBJS)\corelib_toplvcmn.obj \
$(OBJS)\corelib_treebase.obj \
$(OBJS)\corelib_valgen.obj \
$(OBJS)\corelib_stockitem.obj \
$(OBJS)\corelib_tbarbase.obj \
$(OBJS)\corelib_textcmn.obj \
+ $(OBJS)\corelib_textentrycmn.obj \
$(OBJS)\corelib_toplvcmn.obj \
$(OBJS)\corelib_treebase.obj \
$(OBJS)\corelib_valgen.obj \
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_textentrycmn.obj: ..\..\src\common\textentrycmn.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monodll_toplvcmn.obj: ..\..\src\common\toplvcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_textentrycmn.obj: ..\..\src\common\textentrycmn.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\monolib_toplvcmn.obj: ..\..\src\common\toplvcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_textentrycmn.obj: ..\..\src\common\textentrycmn.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\coredll_toplvcmn.obj: ..\..\src\common\toplvcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
!endif
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_textentrycmn.obj: ..\..\src\common\textentrycmn.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
+!endif
+
!if "$(USE_GUI)" == "1"
$(OBJS)\corelib_toplvcmn.obj: ..\..\src\common\toplvcmn.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
$(OBJS)\monodll_stockitem.obj &
$(OBJS)\monodll_tbarbase.obj &
$(OBJS)\monodll_textcmn.obj &
+ $(OBJS)\monodll_textentrycmn.obj &
$(OBJS)\monodll_toplvcmn.obj &
$(OBJS)\monodll_treebase.obj &
$(OBJS)\monodll_valgen.obj &
$(OBJS)\monodll_stockitem.obj &
$(OBJS)\monodll_tbarbase.obj &
$(OBJS)\monodll_textcmn.obj &
+ $(OBJS)\monodll_textentrycmn.obj &
$(OBJS)\monodll_toplvcmn.obj &
$(OBJS)\monodll_treebase.obj &
$(OBJS)\monodll_valgen.obj &
$(OBJS)\monolib_stockitem.obj &
$(OBJS)\monolib_tbarbase.obj &
$(OBJS)\monolib_textcmn.obj &
+ $(OBJS)\monolib_textentrycmn.obj &
$(OBJS)\monolib_toplvcmn.obj &
$(OBJS)\monolib_treebase.obj &
$(OBJS)\monolib_valgen.obj &
$(OBJS)\monolib_stockitem.obj &
$(OBJS)\monolib_tbarbase.obj &
$(OBJS)\monolib_textcmn.obj &
+ $(OBJS)\monolib_textentrycmn.obj &
$(OBJS)\monolib_toplvcmn.obj &
$(OBJS)\monolib_treebase.obj &
$(OBJS)\monolib_valgen.obj &
$(OBJS)\coredll_stockitem.obj &
$(OBJS)\coredll_tbarbase.obj &
$(OBJS)\coredll_textcmn.obj &
+ $(OBJS)\coredll_textentrycmn.obj &
$(OBJS)\coredll_toplvcmn.obj &
$(OBJS)\coredll_treebase.obj &
$(OBJS)\coredll_valgen.obj &
$(OBJS)\coredll_stockitem.obj &
$(OBJS)\coredll_tbarbase.obj &
$(OBJS)\coredll_textcmn.obj &
+ $(OBJS)\coredll_textentrycmn.obj &
$(OBJS)\coredll_toplvcmn.obj &
$(OBJS)\coredll_treebase.obj &
$(OBJS)\coredll_valgen.obj &
$(OBJS)\corelib_stockitem.obj &
$(OBJS)\corelib_tbarbase.obj &
$(OBJS)\corelib_textcmn.obj &
+ $(OBJS)\corelib_textentrycmn.obj &
$(OBJS)\corelib_toplvcmn.obj &
$(OBJS)\corelib_treebase.obj &
$(OBJS)\corelib_valgen.obj &
$(OBJS)\corelib_stockitem.obj &
$(OBJS)\corelib_tbarbase.obj &
$(OBJS)\corelib_textcmn.obj &
+ $(OBJS)\corelib_textentrycmn.obj &
$(OBJS)\corelib_toplvcmn.obj &
$(OBJS)\corelib_treebase.obj &
$(OBJS)\corelib_valgen.obj &
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
!endif
+!ifeq USE_GUI 1
+$(OBJS)\monodll_textentrycmn.obj : .AUTODEPEND ..\..\src\common\textentrycmn.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
+!endif
+
!ifeq USE_GUI 1
$(OBJS)\monodll_toplvcmn.obj : .AUTODEPEND ..\..\src\common\toplvcmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
!endif
+!ifeq USE_GUI 1
+$(OBJS)\monolib_textentrycmn.obj : .AUTODEPEND ..\..\src\common\textentrycmn.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
+!endif
+
!ifeq USE_GUI 1
$(OBJS)\monolib_toplvcmn.obj : .AUTODEPEND ..\..\src\common\toplvcmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
!endif
+!ifeq USE_GUI 1
+$(OBJS)\coredll_textentrycmn.obj : .AUTODEPEND ..\..\src\common\textentrycmn.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
+!endif
+
!ifeq USE_GUI 1
$(OBJS)\coredll_toplvcmn.obj : .AUTODEPEND ..\..\src\common\toplvcmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
!endif
+!ifeq USE_GUI 1
+$(OBJS)\corelib_textentrycmn.obj : .AUTODEPEND ..\..\src\common\textentrycmn.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
+!endif
+
!ifeq USE_GUI 1
$(OBJS)\corelib_toplvcmn.obj : .AUTODEPEND ..\..\src\common\toplvcmn.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\..\src\common\textentrycmn.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=..\..\src\common\toplvcmn.cpp\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\..\include\wx\textentry.h\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=..\..\include\wx\tglbtn.h\r
# End Source File\r
# Begin Source File\r
// wxComboBoxBase: this interface defines the methods wxComboBox must implement
// ----------------------------------------------------------------------------
-#include "wx/textctrl.h"
#include "wx/ctrlsub.h"
+#include "wx/textentry.h"
-class WXDLLEXPORT wxComboBoxBase : public wxItemContainer
+class WXDLLEXPORT wxComboBoxBase : public wxItemContainer,
+ public wxTextEntry
{
public:
- // wxTextCtrl-like methods wxComboBox must implement
- virtual wxString GetValue() const = 0;
- virtual void SetValue(const wxString& value) = 0;
-
- virtual void Copy() = 0;
- virtual void Cut() = 0;
- virtual void Paste() = 0;
- virtual void SetInsertionPoint(long pos) = 0;
- virtual long GetInsertionPoint() const = 0;
- virtual wxTextPos GetLastPosition() const = 0;
- virtual void Replace(long from, long to, const wxString& value) = 0;
- virtual void SetSelection(long from, long to) = 0;
- virtual void SetEditable(bool editable) = 0;
-
- virtual void SetInsertionPointEnd()
- { SetInsertionPoint(GetLastPosition()); }
- virtual void Remove(long from, long to)
- { Replace(from, to, wxEmptyString); }
-
- virtual bool IsEditable() const = 0;
-
- virtual void Undo() = 0;
- virtual void Redo() = 0;
- virtual void SelectAll() = 0;
-
- virtual bool CanCopy() const = 0;
- virtual bool CanCut() const = 0;
- virtual bool CanPaste() const = 0;
- virtual bool CanUndo() const = 0;
- virtual bool CanRedo() const = 0;
+ // override this to disambiguate between two base classes versions
+ virtual void Clear()
+ {
+ wxTextEntry::Clear();
+ wxItemContainer::Clear();
+ }
+
+ // also bring in GetSelection() versions of both base classes in scope
+ //
+ // NB: GetSelection(from, to) could be already implemented in wxTextEntry
+ // but still make it pure virtual because for some platforms it's not
+ // implemented there and also because the derived class has to override
+ // it anyhow to avoid ambiguity with the other GetSelection()
+ virtual int GetSelection() const = 0;
+ virtual void GetSelection(long *from, long *to) const = 0;
// may return value different from GetSelection() when the combobox
// dropdown is shown and the user selected, but not yet accepted, a value
// different from the old one in it
virtual int GetCurrentSelection() const { return GetSelection(); }
-
- // redeclare inherited SetSelection() overload here as well to avoid
- // virtual function hiding
- virtual void SetSelection(int n) = 0;
};
// ----------------------------------------------------------------------------
#endif // wxUSE_COMBOBOX
-#endif
- // _WX_COMBOBOX_H_BASE_
+#endif // _WX_COMBOBOX_H_BASE_
bool SetStringSelection(const wxString& s);
// return the selected string or empty string if none
- wxString GetStringSelection() const;
+ virtual wxString GetStringSelection() const;
// this is the same as SetSelection( for single-selection controls but
// reads better for multi-selection ones
#endif // wxUSE_MENUS
protected:
- virtual void DoSetValue(const wxString& value, int flags = 0);
+ virtual void DoSetValue(const wxString& value, int flags);
+ virtual bool DoLoadFile(const wxString& file, int fileType);
+ virtual bool DoSaveFile(const wxString& file, int fileType);
// override the base class virtuals involved into geometry calculations
virtual wxSize DoGetBestSize() const;
// wxComboBox
//-----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase
+class WXDLLIMPEXP_CORE wxComboBox : public wxControl,
+ public wxComboBoxBase
{
public:
- inline wxComboBox() { m_strings = NULL; }
- inline wxComboBox(wxWindow *parent, wxWindowID id,
- const wxString& value = wxEmptyString,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- int n = 0, const wxString choices[] = (const wxString *) NULL,
- long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxComboBoxNameStr)
+ wxComboBox() { m_strings = NULL; }
+ wxComboBox(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr)
{
Create(parent, id, value, pos, size, n, choices, style, validator, name);
}
- inline wxComboBox(wxWindow *parent, wxWindowID id,
- const wxString& value,
- const wxPoint& pos,
- const wxSize& size,
- const wxArrayString& choices,
- long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxComboBoxNameStr)
+
+ wxComboBox(wxWindow *parent, wxWindowID id,
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr)
{
Create(parent, id, value, pos, size, choices, style, validator, name);
}
virtual ~wxComboBox();
bool Create(wxWindow *parent, wxWindowID id,
- const wxString& value = wxEmptyString,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- int n = 0, const wxString choices[] = (const wxString *) NULL,
- long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxComboBoxNameStr);
+ const wxString& value = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = (const wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
bool Create(wxWindow *parent, wxWindowID id,
- const wxString& value,
- const wxPoint& pos,
- const wxSize& size,
- const wxArrayString& choices,
- long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxComboBoxNameStr);
+ const wxString& value,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxComboBoxNameStr);
// From wxItemContainerImmutable:
virtual unsigned int GetCount() const;
virtual int FindString(const wxString& s, bool bCase = false) const;
virtual void SetSelection(int n);
virtual int GetSelection() const;
- wxString GetStringSelection() const; // not a virtual in parent class
- // From wxItemContainer:
- virtual void DoClear();
- virtual void DoDeleteOneItem(unsigned int n);
+ // from wxTextEntry: we need to override them to avoid virtual function
+ // hiding
+ virtual void SetSelection(long from, long to)
+ {
+ wxTextEntry::SetSelection(from, to);
+ }
- // From wxBomboBoxBase:
- virtual wxString GetValue() const;
- virtual void SetValue(const wxString& value);
- virtual void Copy();
- virtual void Cut();
- virtual void Paste();
- virtual void SetInsertionPoint( long pos );
- virtual long GetInsertionPoint() const;
- virtual wxTextPos GetLastPosition() const;
- virtual void Replace( long from, long to, const wxString& value );
- virtual void SetSelection( long from, long to );
- virtual void SetEditable( bool editable );
- virtual void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
- virtual void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
- virtual bool IsEditable() const;
- virtual void Undo();
- virtual void Redo();
- virtual void SelectAll();
- virtual bool CanCopy() const;
- virtual bool CanCut() const;
- virtual bool CanPaste() const;
- virtual bool CanUndo() const;
- virtual bool CanRedo() const;
-
- // implementation
- bool HasSelection() const;
- void GetSelection( long* from, long* to ) const;
- int GetCurrentSelection() const;
+ virtual void GetSelection(long *from, long *to) const
+ {
+ return wxTextEntry::GetSelection(from, to);
+ }
+
+ virtual wxString GetStringSelection() const
+ {
+ return wxItemContainer::GetStringSelection();
+ }
+
+ // From wxComboBoxBase:
+ virtual int GetCurrentSelection() const;
virtual void SetFocus();
virtual void DoSetItemClientData(unsigned int n, void* clientData);
virtual void* DoGetItemClientData(unsigned int n) const;
virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
+ virtual void DoClear();
+ virtual void DoDeleteOneItem(unsigned int n);
// From wxControl:
virtual wxSize DoGetBestSize() const;
+ // From wxTextEntry:
+ virtual const wxWindow *GetEditableWindow() const { return this; }
+ virtual GtkEditable *GetEditable() const;
+ virtual void EnableTextChangedEvents(bool enable)
+ {
+ if ( enable )
+ EnableEvents();
+ else
+ DisableEvents();
+ }
+
// Widgets that use the style->base colour for the BG colour should
// override this and return true.
virtual bool UseGTKStyleBase() const { return true; }
// implement base class pure virtuals
// ----------------------------------
+ virtual void WriteText(const wxString& text);
virtual wxString GetValue() const;
virtual bool IsEmpty() const;
virtual bool IsModified() const;
virtual bool IsEditable() const;
- // If the return values from and to are the same, there is no selection.
virtual void GetSelection(long* from, long* to) const;
- // operations
- // ----------
-
- // editing
- virtual void Clear();
- virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
- // sets/clears the dirty flag
virtual void MarkDirty();
virtual void DiscardEdits();
- virtual void SetMaxLength(unsigned long len);
-
- // writing text inserts it at the current position, appending always
- // inserts it at the end
- virtual void WriteText(const wxString& text);
- virtual void AppendText(const wxString& text);
-
- // apply text attribute to the range of text (only works with richedit
- // controls)
virtual bool SetStyle(long start, long end, const wxTextAttr& style);
// translate between the position (which is just an index in the text ctrl
virtual void Cut();
virtual void Paste();
- // Undo/redo
- virtual void Undo();
- virtual void Redo();
-
- virtual bool CanUndo() const;
- virtual bool CanRedo() const;
-
// Insertion point
virtual void SetInsertionPoint(long pos);
- virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual wxTextPos GetLastPosition() const;
bool IsFrozen() const { return m_freezeCount > 0; }
protected:
+ // overridden wxWindow virtual methods
virtual wxSize DoGetBestSize() const;
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+ // overridden wxTextEntry virtual methods
+ virtual const wxWindow *GetEditableWindow() const { return this; }
+ virtual GtkEditable *GetEditable() const;
+ virtual void EnableTextChangedEvents(bool enable);
+
// common part of all ctors
void Init();
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/gtk/textentry.h
+// Purpose: wxGTK-specific wxTextEntry implementation
+// Author: Vadim Zeitlin
+// Created: 2007-09-24
+// RCS-ID: $Id$
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_TEXTENTRY_H_
+#define _WX_GTK_TEXTENTRY_H_
+
+typedef struct _GtkEditable GtkEditable;
+
+// ----------------------------------------------------------------------------
+// wxTextEntry: roughly corresponds to GtkEditable
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
+{
+public:
+ wxTextEntry() { }
+
+ // implement wxTextEntryBase pure virtual methods
+ virtual void WriteText(const wxString& text);
+ virtual wxString GetValue() const;
+ virtual void Remove(long from, long to);
+
+ virtual void Copy();
+ virtual void Cut();
+ virtual void Paste();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual bool CanUndo() const;
+ virtual bool CanRedo() const;
+
+ virtual void SetInsertionPoint(long pos);
+ virtual long GetInsertionPoint() const;
+ virtual long GetLastPosition() const;
+
+ virtual void SetSelection(long from, long to);
+ virtual void GetSelection(long *from, long *to) const;
+
+ // status
+ virtual bool IsEditable() const;
+ virtual void SetEditable(bool editable);
+
+ // set the max number of characters which may be entered in a single line
+ // text control
+ virtual void SetMaxLength(unsigned long len);
+
+
+ // implementation only from now on
+ void SendMaxLenEvent();
+
+private:
+ // implement this to return the associated window, it will be used for
+ // event generation
+ virtual const wxWindow *GetEditableWindow() const = 0;
+
+ // implement this to return the associated GtkEntry or another widget
+ // implementing GtkEditable
+ virtual GtkEditable *GetEditable() const = 0;
+};
+
+#endif // _WX_GTK_TEXTENTRY_H_
+
virtual void SetString(unsigned int n, const wxString& s);
// Text field functions
- virtual wxString GetValue() const;
virtual void SetValue(const wxString& value);
+ virtual wxString GetValue() const;
+ virtual void WriteText(const wxString& text);
+ virtual void GetSelection(long *from, long *to) const;
// Clipboard operations
virtual void Copy();
* wxRichTextCtrl class declaration
*/
-class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl : public wxTextCtrlBase,
+class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl : public wxControl,
+ public wxTextCtrlIface,
public wxScrollHelper
{
DECLARE_CLASS( wxRichTextCtrl )
////@begin forward declarations
class wxSymbolListCtrl;
+
+class WXDLLIMPEXP_CORE wxTextCtrl;
+
////@end forward declarations
// __UNICODE__ is a symbol used by DialogBlocks-generated code.
// no native version, use the generic one
#define wxUSE_NATIVE_SEARCH_CONTROL 0
- #define wxSearchCtrlBaseBaseClass wxTextCtrlBase
+ class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass : public wxControl,
+ public wxTextCtrlIface
+ {
+ };
#endif
// ----------------------------------------------------------------------------
#if wxUSE_TEXTCTRL
#include "wx/control.h" // the base class
+#include "wx/textentry.h" // single-line text entry interface
#include "wx/dynarray.h" // wxArrayInt
#include "wx/gdicmn.h" // wxPoint
// wxTextCtrl types
// ----------------------------------------------------------------------------
-// wxTextPos is the position in the text
-typedef long wxTextPos;
-
// wxTextCoord is the line or row number (which should have been unsigned but
// is long for backwards compatibility)
typedef long wxTextCoord;
};
// ----------------------------------------------------------------------------
-// wxTextCtrl: a single or multiple line text zone where user can enter and
-// edit text
+// wxTextAreaBase: multiline text control specific methods
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxTextCtrlBase : public wxControl
-#if wxHAS_TEXT_WINDOW_STREAM
- , public wxSTD streambuf
-#endif
-
+class WXDLLIMPEXP_CORE wxTextAreaBase
{
public:
- // creation
- // --------
+ wxTextAreaBase() { }
+ virtual ~wxTextAreaBase() { }
- wxTextCtrlBase(){}
- virtual ~wxTextCtrlBase(){}
-
- // accessors
- // ---------
-
- virtual wxString GetValue() const = 0;
- virtual bool IsEmpty() const { return GetValue().empty(); }
-
- virtual void SetValue(const wxString& value)
- { DoSetValue(value, SetValue_SendEvent); }
- virtual void ChangeValue(const wxString& value)
- { DoSetValue(value); }
-
- virtual wxString GetRange(long from, long to) const;
+ // lines access
+ // ------------
virtual int GetLineLength(long lineNo) const = 0;
virtual wxString GetLineText(long lineNo) const = 0;
virtual int GetNumberOfLines() const = 0;
- virtual bool IsModified() const = 0;
- virtual bool IsEditable() const = 0;
- // more readable flag testing methods
- bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); }
- bool IsMultiLine() const { return !IsSingleLine(); }
+ // file IO
+ // -------
- // If the return values from and to are the same, there is no selection.
- virtual void GetSelection(long* from, long* to) const = 0;
-
- virtual wxString GetStringSelection() const;
-
- // operations
- // ----------
+ bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY)
+ { return DoLoadFile(file, fileType); }
+ bool SaveFile(const wxString& file = wxEmptyString,
+ int fileType = wxTEXT_TYPE_ANY);
- // editing
- virtual void Clear() = 0;
- virtual void Replace(long from, long to, const wxString& value) = 0;
- virtual void Remove(long from, long to) = 0;
+ // dirty flag handling
+ // -------------------
- // load/save the control's contents from/to a file
- bool LoadFile(const wxString& file, int fileType = wxTEXT_TYPE_ANY) { return DoLoadFile(file, fileType); }
- bool SaveFile(const wxString& file = wxEmptyString, int fileType = wxTEXT_TYPE_ANY);
-
- // implementation for loading/saving
- virtual bool DoLoadFile(const wxString& file, int fileType);
- virtual bool DoSaveFile(const wxString& file, int fileType);
-
- // sets/clears the dirty flag
+ virtual bool IsModified() const = 0;
virtual void MarkDirty() = 0;
virtual void DiscardEdits() = 0;
void SetModified(bool modified)
DiscardEdits();
}
- // set the max number of characters which may be entered in a single line
- // text control
- virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
- // writing text inserts it at the current position, appending always
- // inserts it at the end
- virtual void WriteText(const wxString& text) = 0;
- virtual void AppendText(const wxString& text) = 0;
-
- // insert the character which would have resulted from this key event,
- // return true if anything has been inserted
- virtual bool EmulateKeyPress(const wxKeyEvent& event);
+ // styles handling
+ // ---------------
// text control under some platforms supports the text styles: these
// methods allow to apply the given text style to the given selection or to
// set/get the style which will be used for all appended text
- virtual bool SetStyle(long start, long end, const wxTextAttr& style);
- virtual bool GetStyle(long position, wxTextAttr& style);
- virtual bool SetDefaultStyle(const wxTextAttr& style);
- virtual const wxTextAttr& GetDefaultStyle() const;
+ virtual bool SetStyle(long start, long end, const wxTextAttr& style) = 0;
+ virtual bool GetStyle(long position, wxTextAttr& style) = 0;
+ virtual bool SetDefaultStyle(const wxTextAttr& style) = 0;
+ virtual const wxTextAttr& GetDefaultStyle() const { return m_defaultStyle; }
+
+
+ // coordinates translation
+ // -----------------------
// translate between the position (which is just an index in the text ctrl
// considering all its contents as a single strings) and (x, y) coordinates
wxTextCoord *col,
wxTextCoord *row) const;
- // Clipboard operations
- virtual void Copy() = 0;
- virtual void Cut() = 0;
- virtual void Paste() = 0;
+protected:
+ // implementation of loading/saving
+ virtual bool DoLoadFile(const wxString& file, int fileType) = 0;
+ virtual bool DoSaveFile(const wxString& file, int fileType) = 0;
+
- virtual bool CanCopy() const;
- virtual bool CanCut() const;
- virtual bool CanPaste() const;
+ // the name of the last file loaded with LoadFile() which will be used by
+ // SaveFile() by default
+ wxString m_filename;
- // Undo/redo
- virtual void Undo() = 0;
- virtual void Redo() = 0;
+ // the text style which will be used for any new text added to the control
+ wxTextAttr m_defaultStyle;
- virtual bool CanUndo() const = 0;
- virtual bool CanRedo() const = 0;
- // Insertion point
- virtual void SetInsertionPoint(long pos) = 0;
- virtual void SetInsertionPointEnd() = 0;
- virtual long GetInsertionPoint() const = 0;
- virtual wxTextPos GetLastPosition() const = 0;
+ DECLARE_NO_COPY_CLASS(wxTextAreaBase)
+};
- virtual void SetSelection(long from, long to) = 0;
- virtual void SelectAll();
- virtual void SetEditable(bool editable) = 0;
+// this class defines wxTextCtrl interface, wxTextCtrlBase actually implements
+// too much things because it derives from wxTextEntry and not wxTextEntryBase
+// and so any classes which "look like" wxTextCtrl (such as wxRichTextCtrl)
+// but don't need the (native) implementation bits from wxTextEntry should
+// actually derive from this one and not wxTextCtrlBase
+class WXDLLIMPEXP_CORE wxTextCtrlIface : public wxTextAreaBase,
+ public wxTextEntryBase
+{
+public:
+ wxTextCtrlIface() { }
+
+private:
+ DECLARE_NO_COPY_CLASS(wxTextCtrlIface)
+};
+
+// ----------------------------------------------------------------------------
+// wxTextCtrl: a single or multiple line text zone where user can edit text
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxTextCtrlBase : public wxControl,
+#if wxHAS_TEXT_WINDOW_STREAM
+ public wxSTD streambuf,
+#endif
+ public wxTextAreaBase,
+ public wxTextEntry
+{
+public:
+ // creation
+ // --------
+
+ wxTextCtrlBase() { }
+ virtual ~wxTextCtrlBase() { }
+
+
+ // more readable flag testing methods
+ bool IsSingleLine() const { return !HasFlag(wxTE_MULTILINE); }
+ bool IsMultiLine() const { return !IsSingleLine(); }
// stream-like insertion operators: these are always available, whether we
// were, or not, compiled with streambuf support
wxTextCtrl& operator<<(double d);
wxTextCtrl& operator<<(const wxChar c);
+ // insert the character which would have resulted from this key event,
+ // return true if anything has been inserted
+ virtual bool EmulateKeyPress(const wxKeyEvent& event);
+
+
// generate the wxEVT_COMMAND_TEXT_UPDATED event, like SetValue() does
- void SendTextUpdatedEvent();
+ static void SendTextUpdatedEvent(wxWindow *win);
+ void SendTextUpdatedEvent() { SendTextUpdatedEvent(this); }
// do the window-specific processing after processing the update event
virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
virtual bool ShouldInheritColours() const { return false; }
+ // work around the problem with having HitTest() both in wxControl and
+ // wxTextAreaBase base classes
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const
+ {
+ return wxTextAreaBase::HitTest(pt, pos);
+ }
+
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
+ wxTextCoord *col,
+ wxTextCoord *row) const
+ {
+ return wxTextAreaBase::HitTest(pt, col, row);
+ }
+
+ // we provide stubs for these functions as not all platforms have styles
+ // support, but we really should leave them pure virtual here
+ virtual bool SetStyle(long start, long end, const wxTextAttr& style);
+ virtual bool GetStyle(long position, wxTextAttr& style);
+ virtual bool SetDefaultStyle(const wxTextAttr& style);
+
protected:
// override streambuf method
#if wxHAS_TEXT_WINDOW_STREAM
int overflow(int i);
#endif // wxHAS_TEXT_WINDOW_STREAM
- // flags for DoSetValue(): common part of SetValue() and ChangeValue() and
- // also used to implement WriteText() in wxMSW
- enum
- {
- SetValue_SendEvent = 1,
- SetValue_SelectionOnly = 2
- };
-
- virtual void DoSetValue(const wxString& value, int flags = 0) = 0;
-
-
- // the name of the last file loaded with LoadFile() which will be used by
- // SaveFile() by default
- wxString m_filename;
+ virtual bool DoLoadFile(const wxString& file, int fileType);
+ virtual bool DoSaveFile(const wxString& file, int fileType);
- // the text style which will be used for any new text added to the control
- wxTextAttr m_defaultStyle;
DECLARE_NO_COPY_CLASS(wxTextCtrlBase)
DECLARE_ABSTRACT_CLASS(wxTextCtrlBase)
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/textentry.h
+// Purpose: declares wxTextEntry interface defining a simple text entry
+// Author: Vadim Zeitlin
+// Created: 2007-09-24
+// RCS-ID: $Id$
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TEXTENTRY_H_
+#define _WX_TEXTENTRY_H_
+
+// wxTextPos is the position in the text (currently it's hardly used anywhere
+// and should probably be replaced with int anyhow)
+typedef long wxTextPos;
+
+// ----------------------------------------------------------------------------
+// wxTextEntryBase
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxTextEntryBase
+{
+public:
+ wxTextEntryBase() { m_eventsBlock = 0; }
+ virtual ~wxTextEntryBase() { }
+
+
+ // accessing the value
+ // -------------------
+
+ // SetValue() generates a text change event, ChangeValue() doesn't
+ virtual void SetValue(const wxString& value)
+ { DoSetValue(value, SetValue_SendEvent); }
+ virtual void ChangeValue(const wxString& value)
+ { DoSetValue(value, SetValue_NoEvent); }
+
+ // writing text inserts it at the current position replacing any current
+ // selection, appending always inserts it at the end and doesn't remove any
+ // existing text (but it will reset the selection if there is any)
+ virtual void WriteText(const wxString& text) = 0;
+ virtual void AppendText(const wxString& text);
+
+ virtual wxString GetValue() const = 0;
+ virtual wxString GetRange(long from, long to) const;
+ bool IsEmpty() const { return GetValue().empty(); }
+
+
+ // editing operations
+ // ------------------
+
+ virtual void Replace(long from, long to, const wxString& value);
+ virtual void Remove(long from, long to) = 0;
+ virtual void Clear() { SetValue(wxString()); }
+
+
+ // clipboard operations
+ // --------------------
+
+ virtual void Copy() = 0;
+ virtual void Cut() = 0;
+ virtual void Paste() = 0;
+
+ virtual bool CanCopy() const;
+ virtual bool CanCut() const;
+ virtual bool CanPaste() const;
+
+ // undo/redo
+ // ---------
+
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
+
+ virtual bool CanUndo() const = 0;
+ virtual bool CanRedo() const = 0;
+
+
+ // insertion point
+ // ---------------
+
+ // note that moving insertion point removes any current selection
+ virtual void SetInsertionPoint(long pos) = 0;
+ virtual void SetInsertionPointEnd() { SetInsertionPoint(-1); }
+ virtual long GetInsertionPoint() const = 0;
+ virtual long GetLastPosition() const = 0;
+
+
+ // selection
+ // ---------
+
+ virtual void SetSelection(long from, long to) = 0;
+ virtual void SelectAll() { SetSelection(0, GetLastPosition()); }
+ virtual void GetSelection(long *from, long *to) const = 0;
+ bool HasSelection() const;
+ virtual wxString GetStringSelection() const;
+
+
+ // status
+ // ------
+ virtual bool IsEditable() const = 0;
+ virtual void SetEditable(bool editable) = 0;
+
+
+ // set the max number of characters which may be entered in a single line
+ // text control
+ virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
+
+
+protected:
+ // flags for DoSetValue(): common part of SetValue() and ChangeValue() and
+ // also used to implement WriteText() in wxMSW
+ enum
+ {
+ SetValue_NoEvent = 0,
+ SetValue_SendEvent = 1,
+ SetValue_SelectionOnly = 2
+ };
+
+ virtual void DoSetValue(const wxString& value, int flags);
+
+ // class which should be used to temporarily disable text change events
+ //
+ // if suppress argument in ctor is false, nothing is done
+ class EventsSuppressor
+ {
+ public:
+ EventsSuppressor(wxTextEntryBase *text, bool suppress = true)
+ {
+ m_suppress = suppress;
+ if ( m_suppress )
+ {
+ m_text = text;
+ m_text->SuppressTextChangedEvents();
+ }
+ }
+
+ ~EventsSuppressor()
+ {
+ if ( m_suppress )
+ m_text->ResumeTextChangedEvents();
+ }
+
+ private:
+ wxTextEntryBase *m_text;
+ bool m_suppress;
+ };
+
+ // return true if the events are currently not suppressed
+ bool EventsAllowed() const { return m_eventsBlock == 0; }
+
+private:
+ // suppress or resume the text changed events generation: don't use these
+ // functions directly, use EventsSuppressor class above instead
+ void SuppressTextChangedEvents()
+ {
+ if ( !m_eventsBlock++ )
+ EnableTextChangedEvents(false);
+ }
+
+ void ResumeTextChangedEvents()
+ {
+ if ( !--m_eventsBlock )
+ EnableTextChangedEvents(true);
+ }
+
+
+ // this must be overridden in the derived classes if our implementation of
+ // SetValue() or Replace() is used to disable (and enable back) generation
+ // of the text changed events
+ //
+ // initially the generation of the events is enabled
+ virtual void EnableTextChangedEvents(bool WXUNUSED(enable)) { }
+
+
+ friend class EventsSuppressor;
+
+ // if this counter is non-null, events are blocked
+ unsigned m_eventsBlock;
+};
+
+#ifdef __WXGTK20__
+ #include "wx/gtk/textentry.h"
+#else
+ // no platform-specific implementation of wxTextEntry yet
+ class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
+ {
+ };
+#endif
+
+#endif // _WX_TEXTENTRY_H_
+
// wxTextCtrl methods
virtual wxString GetValue() const;
virtual void SetValue(const wxString& value);
+ virtual void WriteText(const wxString& value);
virtual void Copy();
virtual void Cut();
virtual void Paste();
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
+ virtual void GetSelection(long *from, long *to) const;
virtual void SetEditable(bool editable);
virtual bool IsEditable() const;
virtual int FindString(const wxString& s, bool bCase = false) const;
virtual void SetSelection(int n);
virtual int GetSelection() const;
+ virtual wxString GetStringSelection() const;
wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
#include "wx/settings.h"
#include "wx/dialog.h"
#include "wx/timer.h"
+ #include "wx/textctrl.h"
#endif
#include "wx/tooltip.h"
bool wxTextCtrlBase::SetStyle(long WXUNUSED(start), long WXUNUSED(end),
const wxTextAttr& WXUNUSED(style))
{
- // to be implemented in derived TextCtrl classes
+ // to be implemented in derived classes
return false;
}
// get the styling at the given position
bool wxTextCtrlBase::GetStyle(long WXUNUSED(position), wxTextAttr& WXUNUSED(style))
{
- // to be implemented in derived TextCtrl classes
+ // to be implemented in derived classes
return false;
}
return true;
}
-// get default text attributes
-const wxTextAttr& wxTextCtrlBase::GetDefaultStyle() const
-{
- return m_defaultStyle;
-}
-
// ----------------------------------------------------------------------------
// file IO functions
// ----------------------------------------------------------------------------
return false;
}
-bool wxTextCtrlBase::SaveFile(const wxString& filename, int fileType)
+bool wxTextAreaBase::SaveFile(const wxString& filename, int fileType)
{
wxString filenameToUse = filename.empty() ? m_filename : filename;
if ( filenameToUse.empty() )
#endif // wxHAS_TEXT_WINDOW_STREAM
-// ----------------------------------------------------------------------------
-// clipboard stuff
-// ----------------------------------------------------------------------------
-
-bool wxTextCtrlBase::CanCopy() const
-{
- // can copy if there's a selection
- long from, to;
- GetSelection(&from, &to);
- return from != to;
-}
-
-bool wxTextCtrlBase::CanCut() const
-{
- // can cut if there's a selection and if we're not read only
- return CanCopy() && IsEditable();
-}
-
-bool wxTextCtrlBase::CanPaste() const
-{
- // can paste if we are not read only
- return IsEditable();
-}
-
// ----------------------------------------------------------------------------
// emulating key presses
// ----------------------------------------------------------------------------
-#ifdef __WIN32__
-// the generic version is unused in wxMSW
-bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& WXUNUSED(event))
-{
- return false;
-}
-#else // !__WIN32__
bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event)
{
+ // we have a native implementation for Win32 and so don't need this one
+#ifndef __WIN32__
wxChar ch = 0;
int keycode = event.GetKeyCode();
switch ( keycode )
return true;
}
-
- return false;
-}
#endif // !__WIN32__
-// ----------------------------------------------------------------------------
-// selection and ranges
-// ----------------------------------------------------------------------------
-
-void wxTextCtrlBase::SelectAll()
-{
- SetSelection(0, GetLastPosition());
-}
-
-wxString wxTextCtrlBase::GetStringSelection() const
-{
- long from, to;
- GetSelection(&from, &to);
-
- return GetRange(from, to);
-}
-
-wxString wxTextCtrlBase::GetRange(long from, long to) const
-{
- wxString sel;
- if ( from < to )
- {
- sel = GetValue().Mid(from, to - from);
- }
-
- return sel;
+ return false;
}
// do the window-specific processing after processing the update event
// ----------------------------------------------------------------------------
wxTextCtrlHitTestResult
-wxTextCtrlBase::HitTest(const wxPoint& pt, wxTextCoord *x, wxTextCoord *y) const
+wxTextAreaBase::HitTest(const wxPoint& pt, wxTextCoord *x, wxTextCoord *y) const
{
// implement in terms of the other overload as the native ports typically
// can get the position and not (x, y) pair directly (although wxUniv
}
wxTextCtrlHitTestResult
-wxTextCtrlBase::HitTest(const wxPoint& WXUNUSED(pt),
- long * WXUNUSED(pos)) const
+wxTextAreaBase::HitTest(const wxPoint& WXUNUSED(pt), long * WXUNUSED(pos)) const
{
// not implemented
return wxTE_HT_UNKNOWN;
// events
// ----------------------------------------------------------------------------
-void wxTextCtrlBase::SendTextUpdatedEvent()
+/* static */
+void wxTextCtrlBase::SendTextUpdatedEvent(wxWindow *win)
{
- wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, win->GetId());
// do not do this as it could be very inefficient if the text control
// contains a lot of text and we're not using ref-counted wxString
// implementation -- instead, event.GetString() will query the control for
// its current text if needed
- //event.SetString(GetValue());
+ //event.SetString(win->GetValue());
- event.SetEventObject(this);
- GetEventHandler()->ProcessEvent(event);
+ event.SetEventObject(win);
+ win->GetEventHandler()->ProcessEvent(event);
}
#else // !wxUSE_TEXTCTRL
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/common/textentrycmn.cpp
+// Purpose: wxTextEntryBase implementation
+// Author: Vadim Zeitlin
+// Created: 2007-09-26
+// RCS-ID: $Id$
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_TEXTCTRL || wxUSE_COMBOBOX
+
+#ifndef WX_PRECOMP
+#endif //WX_PRECOMP
+
+#include "wx/textentry.h"
+
+// ============================================================================
+// wxTextEntryBase implementation
+// ============================================================================
+
+wxString wxTextEntryBase::GetRange(long from, long to) const
+{
+ wxString sel;
+ if ( from < to )
+ {
+ sel = GetValue().substr(from, to - from);
+ }
+
+ return sel;
+}
+
+void wxTextEntryBase::AppendText(const wxString& text)
+{
+ SetInsertionPointEnd();
+ WriteText(text);
+}
+
+void wxTextEntryBase::DoSetValue(const wxString& value, int flags)
+{
+ EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent));
+
+ SelectAll();
+ WriteText(value);
+}
+
+void wxTextEntryBase::Replace(long from, long to, const wxString& value)
+{
+ {
+ EventsSuppressor noevents(this);
+ Remove(from, to);
+ }
+
+ WriteText(value);
+}
+
+bool wxTextEntryBase::HasSelection() const
+{
+ long from, to;
+ GetSelection(&from, &to);
+
+ return from < to;
+}
+
+wxString wxTextEntryBase::GetStringSelection() const
+{
+ long from, to;
+ GetSelection(&from, &to);
+
+ return GetRange(from, to);
+}
+
+bool wxTextEntryBase::CanCopy() const
+{
+ return HasSelection();
+}
+
+bool wxTextEntryBase::CanCut() const
+{
+ return CanCopy() && IsEditable();
+}
+
+bool wxTextEntryBase::CanPaste() const
+{
+ return IsEditable();
+}
+
+#endif // wxUSE_TEXTCTRL || wxUSE_COMBOBOX
#include "wx/dcclient.h"
#include "wx/settings.h"
#include "wx/dialog.h"
+ #include "wx/textctrl.h"
#endif
#include "wx/combo.h"
return m_descriptiveText;
}
+
+ // provide access to the base class protected methods to wxSearchCtrl which
+ // needs to forward to them
+ using wxTextCtrl::DoSetValue;
+ using wxTextCtrl::DoLoadFile;
+ using wxTextCtrl::DoSaveFile;
+
protected:
void OnText(wxCommandEvent& eventText)
{
#else
style |= wxBORDER_SIMPLE;
#endif
- if ( !wxTextCtrlBase::Create(parent, id, pos, size, style, validator, name) )
+ if ( !wxSearchCtrlBaseBaseClass::Create(parent, id, pos, size,
+ style, validator, name) )
{
return false;
}
void wxSearchCtrl::DoSetValue(const wxString& value, int flags)
{
- m_text->ChangeValue( value );
- if ( flags & SetValue_SendEvent )
- SendTextUpdatedEvent();
+ m_text->DoSetValue(value, flags);
+}
+
+bool wxSearchCtrl::DoLoadFile(const wxString& file, int fileType)
+{
+ return m_text->DoLoadFile(file, fileType);
+}
+
+bool wxSearchCtrl::DoSaveFile(const wxString& file, int fileType)
+{
+ return m_text->DoSaveFile(file, fileType);
}
// do the window-specific processing after processing the update event
return true;
}
+GtkEditable *wxComboBox::GetEditable() const
+{
+#ifdef __WXGTK24__
+ if ( !gtk_check_version(2,4,0) )
+ return GTK_EDITABLE( GTK_BIN(m_widget)->child );
+ else
+#endif
+ return GTK_EDITABLE( GTK_COMBO(m_widget)->entry );
+}
+
wxComboBox::~wxComboBox()
{
Clear();
return str;
}
-wxString wxComboBox::GetStringSelection() const
-{
- wxCHECK_MSG( m_widget != NULL, wxEmptyString, wxT("invalid combobox") );
-
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- {
- GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
- int sel = gtk_combo_box_get_active( combobox );
- if (sel == -1)
- return wxEmptyString;
- return GetString(sel);
- }
- else
-#endif
- {
- GtkWidget *list = GTK_COMBO(m_widget)->list;
-
- GList *selection = GTK_LIST(list)->selection;
- if (selection)
- {
- GtkBin *bin = GTK_BIN( selection->data );
- GtkLabel *label = GTK_LABEL( bin->child );
- wxString tmp( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
- return tmp;
- }
-
- wxFAIL_MSG( wxT("wxComboBox: no selection") );
- }
-
- return wxEmptyString;
-}
-
unsigned int wxComboBox::GetCount() const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
EnableEvents();
}
-wxString wxComboBox::GetValue() const
-{
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- wxString tmp( wxGTK_CONV_BACK( gtk_entry_get_text( entry ) ) );
-
-#if 0
- for (int i = 0; i < wxStrlen(tmp.c_str()) +1; i++)
- {
- wxChar c = tmp[i];
- printf( "%d ", (int) (c) );
- }
- printf( "\n" );
-#endif
-
- return tmp;
-}
-
-void wxComboBox::SetValue( const wxString& value )
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
-
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- wxString tmp;
- if (!value.IsNull()) tmp = value;
-
- DisableEvents();
- gtk_entry_set_text( entry, wxGTK_CONV( tmp ) );
- EnableEvents();
-
- InvalidateBestSize();
-}
-
-void wxComboBox::Copy()
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
-
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- gtk_editable_copy_clipboard(GTK_EDITABLE(entry));
-}
-
-void wxComboBox::Cut()
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
-
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- gtk_editable_cut_clipboard(GTK_EDITABLE(entry));
-}
-
-void wxComboBox::Paste()
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
-
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- gtk_editable_paste_clipboard(GTK_EDITABLE(entry));
-}
-
-void wxComboBox::Undo()
-{
- // TODO
-}
-
-void wxComboBox::Redo()
-{
- // TODO
-}
-
-void wxComboBox::SelectAll()
-{
- SetSelection(0, GetLastPosition());
-}
-
-bool wxComboBox::CanUndo() const
-{
- // TODO
- return false;
-}
-
-bool wxComboBox::CanRedo() const
-{
- // TODO
- return false;
-}
-
-bool wxComboBox::HasSelection() const
-{
- long from, to;
- GetSelection(&from, &to);
- return from != to;
-}
-
-bool wxComboBox::CanCopy() const
-{
- // Can copy if there's a selection
- return HasSelection();
-}
-
-bool wxComboBox::CanCut() const
-{
- return CanCopy() && IsEditable();
-}
-
-bool wxComboBox::CanPaste() const
-{
- // TODO: check for text on the clipboard
- return IsEditable() ;
-}
-
-bool wxComboBox::IsEditable() const
-{
- return !HasFlag(wxCB_READONLY);
-}
-
-
-void wxComboBox::SetInsertionPoint( long pos )
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
-
- if ( pos == GetLastPosition() )
- pos = -1;
-
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- gtk_entry_set_position( entry, (int)pos );
-}
-
-long wxComboBox::GetInsertionPoint() const
-{
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- return (long) gtk_editable_get_position(GTK_EDITABLE(entry));
-}
-
-wxTextPos wxComboBox::GetLastPosition() const
-{
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- int pos = entry->text_length;
- return (long) pos-1;
-}
-
-void wxComboBox::Replace( long from, long to, const wxString& value )
-{
- wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
-
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
- if (value.IsNull()) return;
- gint pos = (gint)to;
-
- // FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer
-#if wxUSE_UNICODE_UTF8
- const char *utf8 = value.utf8_str();
-#else
- wxCharBuffer buffer(value.utf8_str());
- const char *utf8 = buffer;
-#endif
- gtk_editable_insert_text(GTK_EDITABLE(entry), utf8, strlen(utf8), &pos);
-}
-
-void wxComboBox::SetSelection( long from, long to )
-{
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- gtk_editable_select_region( GTK_EDITABLE(entry), (gint)from, (gint)to );
-}
-
-void wxComboBox::GetSelection( long* from, long* to ) const
-{
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- if (IsEditable())
- {
- GtkEditable *editable = GTK_EDITABLE(entry);
- gint start, end;
- gtk_editable_get_selection_bounds(editable, & start, & end);
- *from = start;
- *to = end;
- }
-}
-
-void wxComboBox::SetEditable( bool editable )
-{
- GtkEntry *entry = NULL;
-#ifdef __WXGTK24__
- if (!gtk_check_version(2,4,0))
- entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
- else
-#endif
- entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
-
- gtk_entry_set_editable( GTK_ENTRY(entry), editable );
-}
-
void wxComboBox::OnChar( wxKeyEvent &event )
{
if ( event.GetKeyCode() == WXK_RETURN )
event.Enable(GetLastPosition() > 0);
}
-#endif
+#endif // wxUSE_COMBOBOX
wxGtkTextApplyTagsFromAttr(text, text_buffer, attr, &start, &iter);
}
-// ----------------------------------------------------------------------------
-// "insert_text" for GtkEntry
-// ----------------------------------------------------------------------------
-
-extern "C" {
-static void
-gtk_insert_text_callback(GtkEditable *editable,
- const gchar *new_text,
- gint new_text_length,
- gint *position,
- wxTextCtrl *win)
-{
- // we should only be called if we have a max len limit at all
- GtkEntry *entry = GTK_ENTRY (editable);
-
- wxCHECK_RET( entry->text_max_length, _T("shouldn't be called") );
-
- // check that we don't overflow the max length limit
- //
- // FIXME: this doesn't work when we paste a string which is going to be
- // truncated
- if ( entry->text_length == entry->text_max_length )
- {
- // we don't need to run the base class version at all
- g_signal_stop_emission_by_name (editable, "insert_text");
-
- // remember that the next changed signal is to be ignored to avoid
- // generating a dummy wxEVT_COMMAND_TEXT_UPDATED event
- win->IgnoreNextTextUpdate();
-
- // and generate the correct one ourselves
- wxCommandEvent event(wxEVT_COMMAND_TEXT_MAXLEN, win->GetId());
- event.SetEventObject(win);
- event.SetString(win->GetValue());
- win->GetEventHandler()->ProcessEvent( event );
- }
-}
-}
-
// Implementation of wxTE_AUTO_URL for wxGTK2 by Mart Raudsepp,
extern "C" {
au_check_range(&start, &end);
}
}
-
+
g_signal_connect (m_text, "copy-clipboard",
G_CALLBACK (gtk_copy_clipboard_callback), this);
g_signal_connect (m_text, "cut-clipboard",
return true;
}
+GtkEditable *wxTextCtrl::GetEditable() const
+{
+ wxCHECK_MSG( IsSingleLine(), NULL, "shouldn't be called for multiline" );
+
+ return GTK_EDITABLE(m_text);
+}
+
// ----------------------------------------------------------------------------
// flags handling
// ----------------------------------------------------------------------------
return wxGTK_CONV_BACK(text);
}
- else
+ else // single line
{
- const gchar *text = gtk_entry_get_text( GTK_ENTRY(m_text) );
- return wxGTK_CONV_BACK(text);
+ return wxTextEntry::GetValue();
}
}
if ( IsMultiLine() )
return gtk_text_buffer_get_char_count(m_buffer) == 0;
- return wxTextCtrlBase::IsEmpty();
+ return wxTextEntry::IsEmpty();
}
void wxTextCtrl::DoSetValue( const wxString &value, int flags )
m_modified = false;
+ if ( !IsMultiLine() )
+ {
+ wxTextEntry::DoSetValue(value, flags);
+ return;
+ }
+
wxFontEncoding enc = m_defaultStyle.HasFont()
? m_defaultStyle.GetFont().GetEncoding()
: wxFONTENCODING_SYSTEM;
if ( !(flags & SetValue_SendEvent) )
{
- g_signal_handlers_block_by_func(GetTextObject(),
- (gpointer)gtk_text_changed_callback, this);
+ EnableTextChangedEvents(false);
}
- if ( IsMultiLine() )
- {
- gtk_text_buffer_set_text( m_buffer, buffer, strlen(buffer) );
-
- if ( !m_defaultStyle.IsDefault() )
- {
- GtkTextIter start, end;
- gtk_text_buffer_get_bounds( m_buffer, &start, &end );
- wxGtkTextApplyTagsFromAttr(m_widget, m_buffer, m_defaultStyle,
- &start, &end);
- }
- }
- else // single line
+ gtk_text_buffer_set_text( m_buffer, buffer, strlen(buffer) );
+
+ if ( !m_defaultStyle.IsDefault() )
{
- gtk_entry_set_text( GTK_ENTRY(m_text), buffer );
+ GtkTextIter start, end;
+ gtk_text_buffer_get_bounds( m_buffer, &start, &end );
+ wxGtkTextApplyTagsFromAttr(m_widget, m_buffer, m_defaultStyle,
+ &start, &end);
}
if ( !(flags & SetValue_SendEvent) )
{
- g_signal_handlers_unblock_by_func(GetTextObject(),
- (gpointer)gtk_text_changed_callback, this);
+ EnableTextChangedEvents(true);
}
-
+
// This was added after discussion on the list
SetInsertionPoint(0);
}
{
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
- if ( text.empty() )
+ // we're changing the text programmatically
+ DontMarkDirtyOnNextChange();
+
+ if ( !IsMultiLine() )
+ {
+ wxTextEntry::WriteText(text);
return;
+ }
// check if we have a specific style for the current position
wxFontEncoding enc = wxFONTENCODING_SYSTEM;
return;
}
- // we're changing the text programmatically
- DontMarkDirtyOnNextChange();
+ // First remove the selection if there is one
+ // TODO: Is there an easier GTK specific way to do this?
+ long from, to;
+ GetSelection(&from, &to);
+ if (from != to)
+ Remove(from, to);
- if ( IsMultiLine() )
- {
- // First remove the selection if there is one
- // TODO: Is there an easier GTK specific way to do this?
- long from, to;
- GetSelection(&from, &to);
- if (from != to)
- Remove(from, to);
+ // Insert the text
+ wxGtkTextInsert( m_text, m_buffer, m_defaultStyle, buffer );
- // Insert the text
- wxGtkTextInsert( m_text, m_buffer, m_defaultStyle, buffer );
-
- GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(m_widget) );
- // Scroll to cursor, but only if scrollbar thumb is at the very bottom
- // won't work when frozen, text view is not using m_buffer then
- if (!IsFrozen() && wxIsSameDouble(adj->value, adj->upper - adj->page_size))
- {
- gtk_text_view_scroll_to_mark( GTK_TEXT_VIEW(m_text),
- gtk_text_buffer_get_insert( m_buffer ), 0.0, FALSE, 0.0, 1.0 );
- }
- }
- else // single line
+ GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(m_widget) );
+ // Scroll to cursor, but only if scrollbar thumb is at the very bottom
+ // won't work when frozen, text view is not using m_buffer then
+ if (!IsFrozen() && wxIsSameDouble(adj->value, adj->upper - adj->page_size))
{
- // First remove the selection if there is one
- gtk_editable_delete_selection( GTK_EDITABLE(m_text) );
-
- // This moves the cursor pos to behind the inserted text.
- gint len = gtk_editable_get_position(GTK_EDITABLE(m_text));
-
- gtk_editable_insert_text( GTK_EDITABLE(m_text), buffer, strlen(buffer), &len );
-
- // Bring entry's cursor uptodate.
- gtk_editable_set_position( GTK_EDITABLE(m_text), len );
+ gtk_text_view_scroll_to_mark( GTK_TEXT_VIEW(m_text),
+ gtk_text_buffer_get_insert( m_buffer ), 0.0, FALSE, 0.0, 1.0 );
}
}
-void wxTextCtrl::AppendText( const wxString &text )
-{
- SetInsertionPointEnd();
- WriteText( text );
-}
-
wxString wxTextCtrl::GetLineText( long lineNo ) const
{
wxString result;
else
gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(m_text), mark);
}
- else
+ else // single line
{
- // FIXME: Is the editable's cursor really uptodate without double set_position in GTK2?
- gtk_editable_set_position(GTK_EDITABLE(m_text), int(pos));
+ wxTextEntry::SetInsertionPoint(pos);
}
}
-void wxTextCtrl::SetInsertionPointEnd()
-{
- SetInsertionPoint(-1);
-}
-
void wxTextCtrl::SetEditable( bool editable )
{
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
{
gtk_text_view_set_editable( GTK_TEXT_VIEW(m_text), editable );
}
- else
+ else // single line
{
- gtk_editable_set_editable( GTK_EDITABLE(m_text), editable );
+ wxTextEntry::SetEditable(editable);
}
}
}
// ----------------------------------------------------------------------------
-// max text length support
+// event handling
// ----------------------------------------------------------------------------
+void wxTextCtrl::EnableTextChangedEvents(bool enable)
+{
+ if ( enable )
+ {
+ g_signal_handlers_unblock_by_func(GetTextObject(),
+ (gpointer)gtk_text_changed_callback, this);
+ }
+ else // disable events
+ {
+ g_signal_handlers_block_by_func(GetTextObject(),
+ (gpointer)gtk_text_changed_callback, this);
+ }
+}
+
bool wxTextCtrl::IgnoreTextUpdate()
{
if ( m_countUpdatesToIgnore > 0 )
return true;
}
-void wxTextCtrl::SetMaxLength(unsigned long len)
-{
- if ( !HasFlag(wxTE_MULTILINE) )
- {
- gtk_entry_set_max_length(GTK_ENTRY(m_text), len);
-
- // there is a bug in GTK+ 1.2.x: "changed" signal is emitted even if
- // we had tried to enter more text than allowed by max text length and
- // the text wasn't really changed
- //
- // to detect this and generate TEXT_MAXLEN event instead of
- // TEXT_CHANGED one in this case we also catch "insert_text" signal
- //
- // when max len is set to 0 we disconnect our handler as it means that
- // we shouldn't check anything any more
- if ( len )
- {
- g_signal_connect (m_text, "insert_text",
- G_CALLBACK (gtk_insert_text_callback), this);
- }
- else // no checking
- {
- g_signal_handlers_disconnect_by_func (m_text,
- (gpointer) gtk_insert_text_callback, this);
- }
- }
-}
-
void wxTextCtrl::SetSelection( long from, long to )
{
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
gtk_text_buffer_place_cursor( m_buffer, &toi );
gtk_text_buffer_move_mark_by_name( m_buffer, "selection_bound", &fromi );
}
- else
+ else // single line
{
- gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
+ wxTextEntry::SetSelection(from, to);
}
}
}
else
{
- return (long) gtk_editable_get_position(GTK_EDITABLE(m_text));
+ return wxTextEntry::GetInsertionPoint();
}
}
pos = gtk_text_iter_get_offset( &end );
}
- else
+ else // single line
{
- pos = GTK_ENTRY(m_text)->text_length;
+ pos = wxTextEntry::GetLastPosition();
}
return (long)pos;
gtk_text_buffer_delete( m_buffer, &fromi, &toi );
}
else // single line
- gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
-}
-
-void wxTextCtrl::Replace( long from, long to, const wxString &value )
-{
- wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
-
- Remove( from, to );
-
- if (!value.empty())
{
- SetInsertionPoint( from );
- WriteText( value );
+ wxTextEntry::Remove(from, to);
}
}
if ( IsMultiLine() )
g_signal_emit_by_name (m_text, "cut-clipboard");
else
- gtk_editable_cut_clipboard(GTK_EDITABLE(m_text));
+ wxTextEntry::Cut();
}
void wxTextCtrl::Copy()
if ( IsMultiLine() )
g_signal_emit_by_name (m_text, "copy-clipboard");
else
- gtk_editable_copy_clipboard(GTK_EDITABLE(m_text));
+ wxTextEntry::Copy();
}
void wxTextCtrl::Paste()
if ( IsMultiLine() )
g_signal_emit_by_name (m_text, "paste-clipboard");
else
- gtk_editable_paste_clipboard(GTK_EDITABLE(m_text));
-}
-
-// Undo/redo
-void wxTextCtrl::Undo()
-{
- // TODO
- wxFAIL_MSG( wxT("wxTextCtrl::Undo not implemented") );
-}
-
-void wxTextCtrl::Redo()
-{
- // TODO
- wxFAIL_MSG( wxT("wxTextCtrl::Redo not implemented") );
-}
-
-bool wxTextCtrl::CanUndo() const
-{
- // TODO
- //wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
- return false;
-}
-
-bool wxTextCtrl::CanRedo() const
-{
- // TODO
- //wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
- return false;
+ wxTextEntry::Paste();
}
// If the return values from and to are the same, there is no
{
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
- gint from = -1;
- gint to = -1;
- bool haveSelection = false;
-
- if ( IsMultiLine() )
- {
- GtkTextIter ifrom, ito;
- if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) )
- {
- haveSelection = true;
- from = gtk_text_iter_get_offset(&ifrom);
- to = gtk_text_iter_get_offset(&ito);
- }
- }
- else // not multi-line
- {
- if ( gtk_editable_get_selection_bounds( GTK_EDITABLE(m_text),
- &from, &to) )
- {
- haveSelection = true;
- }
- }
-
- if (! haveSelection )
- from = to = GetInsertionPoint();
-
- if ( from > to )
- {
- // exchange them to be compatible with wxMSW
- gint tmp = from;
- from = to;
- to = tmp;
- }
+ if ( !IsMultiLine() )
+ {
+ wxTextEntry::GetSelection(fromOut, toOut);
+ return;
+ }
+
+ gint from, to;
+
+ GtkTextIter ifrom, ito;
+ if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) )
+ {
+ from = gtk_text_iter_get_offset(&ifrom);
+ to = gtk_text_iter_get_offset(&ito);
+
+ if ( from > to )
+ {
+ // exchange them to be compatible with wxMSW
+ gint tmp = from;
+ from = to;
+ to = tmp;
+ }
+ }
+ else // no selection
+ {
+ from =
+ to = GetInsertionPoint();
+ }
if ( fromOut )
*fromOut = from;
}
else
{
- return gtk_editable_get_editable(GTK_EDITABLE(m_text));
+ return wxTextEntry::IsEditable();
}
}
return m_modified;
}
-void wxTextCtrl::Clear()
-{
- SetValue( wxEmptyString );
-}
-
void wxTextCtrl::OnChar( wxKeyEvent &key_event )
{
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/gtk/textentry.cpp
+// Purpose: wxTextEntry implementation for wxGTK
+// Author: Vadim Zeitlin
+// Created: 2007-09-24
+// RCS-ID: $Id$
+// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif //WX_PRECOMP
+
+#include "wx/textentry.h"
+
+#include "wx/gtk/private.h"
+
+// ============================================================================
+// signal handlers implementation
+// ============================================================================
+
+extern "C"
+{
+
+// "insert_text" handler for GtkEntry
+static void
+wx_gtk_insert_text_callback(GtkEditable *editable,
+ const gchar *new_text,
+ gint new_text_length,
+ gint *position,
+ wxTextEntry *text)
+{
+ // we should only be called if we have a max len limit at all
+ GtkEntry *entry = GTK_ENTRY (editable);
+
+ wxCHECK_RET( entry->text_max_length, _T("shouldn't be called") );
+
+ // check that we don't overflow the max length limit
+ //
+ // FIXME: this doesn't work when we paste a string which is going to be
+ // truncated
+ if ( entry->text_length == entry->text_max_length )
+ {
+ // we don't need to run the base class version at all
+ g_signal_stop_emission_by_name (editable, "insert_text");
+
+ text->SendMaxLenEvent();
+ }
+}
+
+} // extern "C"
+
+// ============================================================================
+// wxTextEntry implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// text operations
+// ----------------------------------------------------------------------------
+
+void wxTextEntry::WriteText(const wxString& value)
+{
+ GtkEditable * const edit = GetEditable();
+
+ // remove the selection if there is one and suppress the text change event
+ // generated by this: we only want to generate one event for this change,
+ // not two
+ {
+ EventsSuppressor noevents(this);
+ gtk_editable_delete_selection(edit);
+ }
+
+ // insert new text at the cursor position
+ gint len = gtk_editable_get_position(edit);
+ gtk_editable_insert_text
+ (
+ edit,
+ wxGTK_CONV_FONT(value, GetEditableWindow()->GetFont()),
+ -1, // text: length: compute it using strlen()
+ &len // will be updated to position after the text end
+ );
+
+ // and move cursor to the end of new text
+ gtk_editable_set_position(edit, len);
+}
+
+wxString wxTextEntry::GetValue() const
+{
+ const wxGtkString value(gtk_editable_get_chars(GetEditable(), 0, -1));
+
+ return wxGTK_CONV_BACK_FONT(value, GetEditableWindow()->GetFont());
+}
+
+void wxTextEntry::Remove(long from, long to)
+{
+ gtk_editable_delete_text(GetEditable(), from, to);
+}
+
+// ----------------------------------------------------------------------------
+// clipboard operations
+// ----------------------------------------------------------------------------
+
+void wxTextEntry::Copy()
+{
+ gtk_editable_copy_clipboard(GetEditable());
+}
+
+void wxTextEntry::Cut()
+{
+ gtk_editable_cut_clipboard(GetEditable());
+}
+
+void wxTextEntry::Paste()
+{
+ gtk_editable_paste_clipboard(GetEditable());
+}
+
+// ----------------------------------------------------------------------------
+// undo/redo
+// ----------------------------------------------------------------------------
+
+void wxTextEntry::Undo()
+{
+ // TODO: not implemented
+}
+
+void wxTextEntry::Redo()
+{
+ // TODO: not implemented
+}
+
+bool wxTextEntry::CanUndo() const
+{
+ return false;
+}
+
+bool wxTextEntry::CanRedo() const
+{
+ return false;
+}
+
+// ----------------------------------------------------------------------------
+// insertion point
+// ----------------------------------------------------------------------------
+
+void wxTextEntry::SetInsertionPoint(long pos)
+{
+ gtk_editable_set_position(GetEditable(), pos);
+}
+
+long wxTextEntry::GetInsertionPoint() const
+{
+ return gtk_editable_get_position(GetEditable());
+}
+
+long wxTextEntry::GetLastPosition() const
+{
+ // this can't be implemented for arbitrary GtkEditable so only do it for
+ // GtkEntries
+ GtkEntry * const entry = GTK_ENTRY(GetEditable());
+
+ return entry ? entry->text_length : - 1;
+}
+
+// ----------------------------------------------------------------------------
+// selection
+// ----------------------------------------------------------------------------
+
+void wxTextEntry::SetSelection(long from, long to)
+{
+ gtk_editable_select_region(GetEditable(), from, to);
+}
+
+void wxTextEntry::GetSelection(long *from, long *to) const
+{
+ gint start, end;
+ if ( gtk_editable_get_selection_bounds(GetEditable(), &start, &end) )
+ {
+ // the output must always be in order, although in GTK+ it isn't
+ if ( start > end )
+ {
+ gint tmp = start;
+ start = end;
+ end = tmp;
+ }
+ }
+ else // no selection
+ {
+ // for compatibility with MSW return the empty selection at cursor
+ start =
+ end = GetInsertionPoint();
+ }
+
+ if ( from )
+ *from = start;
+
+ if ( to )
+ *to = end;
+}
+
+// ----------------------------------------------------------------------------
+// editable status
+// ----------------------------------------------------------------------------
+
+bool wxTextEntry::IsEditable() const
+{
+ return gtk_editable_get_editable(GetEditable());
+}
+
+void wxTextEntry::SetEditable(bool editable)
+{
+ gtk_editable_set_editable(GetEditable(), editable);
+}
+
+// ----------------------------------------------------------------------------
+// max text length
+// ----------------------------------------------------------------------------
+
+void wxTextEntry::SetMaxLength(unsigned long len)
+{
+ GtkEntry * const entry = GTK_ENTRY(GetEditable());
+ if ( !entry )
+ return;
+
+ gtk_entry_set_max_length(entry, len);
+
+ // there is a bug in GTK+ 1.2.x: "changed" signal is emitted even if we had
+ // tried to enter more text than allowed by max text length and the text
+ // wasn't really changed
+ //
+ // to detect this and generate TEXT_MAXLEN event instead of TEXT_CHANGED
+ // one in this case we also catch "insert_text" signal
+ //
+ // when max len is set to 0 we disconnect our handler as it means that we
+ // shouldn't check anything any more
+ if ( len )
+ {
+ g_signal_connect
+ (
+ entry,
+ "insert_text",
+ G_CALLBACK(wx_gtk_insert_text_callback),
+ this
+ );
+ }
+ else // no max length
+ {
+ g_signal_handlers_disconnect_by_func
+ (
+ entry,
+ (gpointer)wx_gtk_insert_text_callback,
+ this
+ );
+ }
+}
+
+void wxTextEntry::SendMaxLenEvent()
+{
+ // remember that the next changed signal is to be ignored to avoid
+ // generating a dummy wxEVT_COMMAND_TEXT_UPDATED event
+ //IgnoreNextTextUpdate();
+
+ wxWindow * const win = const_cast<wxWindow *>(GetEditableWindow());
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_MAXLEN, win->GetId());
+ event.SetEventObject(win);
+ event.SetString(GetValue());
+ win->GetEventHandler()->ProcessEvent(event);
+}
+
m_text->SetValue( value );
}
+void wxComboBox::WriteText(const wxString& text)
+{
+ m_text->WriteText(text);
+}
+
+void wxComboBox::GetSelection(long *from, long *to) const
+{
+ m_text->GetSelection(from, to);
+}
+
// Clipboard operations
void wxComboBox::Copy()
m_ctrl->Refresh(false);
if (sendUpdateEvent)
- m_ctrl->SendTextUpdatedEvent();
+ wxTextCtrl::SendTextUpdatedEvent(m_ctrl);
}
}
}
bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style,
const wxValidator& validator, const wxString& name)
{
- if (!wxTextCtrlBase::Create(parent, id, pos, size,
- style|wxFULL_REPAINT_ON_RESIZE,
- validator, name))
+ if (!wxControl::Create(parent, id, pos, size,
+ style|wxFULL_REPAINT_ON_RESIZE,
+ validator, name))
return false;
if (!GetFont().Ok())
LayoutContent();
Refresh(false);
}
- SendTextUpdatedEvent();
+
+ wxTextCtrl::SendTextUpdatedEvent(this);
}
/// Painting
PositionCaret();
SetupScrollbars(true);
Refresh(false);
- SendTextUpdatedEvent();
+ wxTextCtrl::SendTextUpdatedEvent(this);
if (success)
return true;
{
// still send an event for consistency
if (flags & SetValue_SendEvent)
- SendTextUpdatedEvent();
+ wxTextCtrl::SendTextUpdatedEvent(this);
}
DiscardEdits();
}
GetBuffer().InsertTextWithUndo(m_caretPosition+1, valueUnix, this, wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
if ( flags & SetValue_SendEvent )
- SendTextUpdatedEvent();
+ wxTextCtrl::SendTextUpdatedEvent(this);
}
void wxRichTextCtrl::AppendText(const wxString& text)
wxComboCtrl::SetValue(value);
}
+void wxComboBox::WriteText(const wxString& value)
+{
+ if ( GetTextCtrl() ) GetTextCtrl()->WriteText(value);
+}
+
void wxComboBox::Copy()
{
if ( GetTextCtrl() ) GetTextCtrl()->Copy();
if ( GetTextCtrl() ) GetTextCtrl()->SetSelection(from, to);
}
+void wxComboBox::GetSelection(long *from, long *to) const
+{
+ if ( GetTextCtrl() ) GetTextCtrl()->GetSelection(from, to);
+}
+
void wxComboBox::SetEditable(bool editable)
{
if ( GetTextCtrl() ) GetTextCtrl()->SetEditable(editable);
#endif
}
+wxString wxComboBox::GetStringSelection() const
+{
+ return GetLBox()->GetStringSelection();
+}
+
void wxComboBox::SetClientDataType(wxClientDataType clientDataItemsType)
{
GetLBox()->SetClientDataType(clientDataItemsType);
void wxTextCtrl::DoSetValue(const wxString& value, int flags)
{
- if ( IsSingleLine() && (value == GetValue()) )
+ if ( value != GetValue() )
{
- // nothing changed
- return;
- }
+ EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent));
- Replace(0, GetLastPosition(), value);
+ Replace(0, GetLastPosition(), value);
- if ( IsSingleLine() )
+ if ( IsSingleLine() )
+ {
+ SetInsertionPoint(0);
+ }
+ }
+ else // nothing changed
{
- SetInsertionPoint(0);
+ // still send event for consistency
+ if ( flags & SetValue_SendEvent )
+ SendTextUpdatedEvent();
}
-
- if ( flags & SetValue_SendEvent )
- SendTextUpdatedEvent();
}
const wxArrayString& wxTextCtrl::GetLines() const
// now call it to do the rest (not related to refreshing)
ClearSelection();
+
+ if ( EventsAllowed() )
+ SendTextUpdatedEvent();
}
void wxTextCtrl::Remove(wxTextPos from, wxTextPos to)