int GetSelection() const { return m_commandInt; }
// Set/Get listbox/choice selection string
- void SetString(char* s) { m_commandString = s; }
- char *GetString() const { return m_commandString; }
+ void SetString(const wxString& s) { m_commandString = s; }
+ const wxString& GetString() const { return m_commandString; }
// Get checkbox value
bool Checked() const { return (m_commandInt != 0); }
long GetInt() const { return m_commandInt ; }
public:
- char* m_commandString; // String event argument
+ wxString m_commandString; // String event argument
int m_commandInt;
long m_extraLong; // Additional information (e.g. select/deselect)
void* m_clientData; // Arbitrary client data
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKCHOICEH__
// wxChoice
//-----------------------------------------------------------------------------
-class wxChoice: public wxControl
+class wxChoice : public wxControl
{
- DECLARE_DYNAMIC_CLASS(wxChoice)
+ DECLARE_DYNAMIC_CLASS(wxChoice)
public:
+ wxChoice();
+ wxChoice( wxWindow *parent, wxWindowID id,
+ 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 = wxChoiceNameStr )
+ {
+ Create(parent, id, pos, size, n, choices, style, validator, name);
+ }
+ ~wxChoice();
+ bool Create( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = (wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxChoiceNameStr );
- wxChoice();
- inline wxChoice( wxWindow *parent, wxWindowID id,
- 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 = wxChoiceNameStr )
- {
- Create(parent, id, pos, size, n, choices, style, validator, name);
- }
- ~wxChoice();
- bool Create( wxWindow *parent, wxWindowID id,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- int n = 0, const wxString choices[] = (wxString *) NULL,
- long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxChoiceNameStr );
-
- void Append( const wxString &item );
- void Append( const wxString &item, void* clientData );
- void Append( const wxString &item, wxClientData* clientData );
-
- void SetClientData( int n, void* clientData );
- void* GetClientData( int n );
- void SetClientObject( int n, wxClientData* clientData );
- wxClientData* GetClientObject( int n );
-
- void Clear();
- void Delete(int n);
-
- int FindString( const wxString &string ) const;
- int GetColumns() const;
- int GetSelection();
- wxString GetString( int n ) const;
- wxString GetStringSelection() const;
- int Number() const;
- void SetColumns( int n = 1 );
- void SetSelection( int n );
- void SetStringSelection( const wxString &string );
-
-// implementation
-
- wxList m_clientDataList;
- wxList m_clientObjectList;
-
- void AppendCommon( const wxString &item );
- void ApplyWidgetStyle();
+ void Append( const wxString &item );
+ void Append( const wxString &item, void* clientData );
+ void Append( const wxString &item, wxClientData* clientData );
+
+ void SetClientData( int n, void* clientData );
+ void* GetClientData( int n );
+ void SetClientObject( int n, wxClientData* clientData );
+ wxClientData* GetClientObject( int n );
+
+ void Clear();
+ void Delete(int n);
+
+ int FindString( const wxString &string ) const;
+ int GetColumns() const;
+ int GetSelection();
+ wxString GetString( int n ) const;
+ wxString GetStringSelection() const;
+ int Number() const;
+ void SetColumns( int n = 1 );
+ void SetSelection( int n );
+ void SetStringSelection( const wxString &string );
+
+ // implementation
+
+ wxList m_clientDataList;
+ wxList m_clientObjectList;
+
+ void AppendCommon( const wxString &item );
+ void ApplyWidgetStyle();
};
#endif // __GTKCHOICEH__
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKCHOICEH__
// wxChoice
//-----------------------------------------------------------------------------
-class wxChoice: public wxControl
+class wxChoice : public wxControl
{
- DECLARE_DYNAMIC_CLASS(wxChoice)
+ DECLARE_DYNAMIC_CLASS(wxChoice)
public:
+ wxChoice();
+ wxChoice( wxWindow *parent, wxWindowID id,
+ 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 = wxChoiceNameStr )
+ {
+ Create(parent, id, pos, size, n, choices, style, validator, name);
+ }
+ ~wxChoice();
+ bool Create( wxWindow *parent, wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ int n = 0, const wxString choices[] = (wxString *) NULL,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxChoiceNameStr );
- wxChoice();
- inline wxChoice( wxWindow *parent, wxWindowID id,
- 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 = wxChoiceNameStr )
- {
- Create(parent, id, pos, size, n, choices, style, validator, name);
- }
- ~wxChoice();
- bool Create( wxWindow *parent, wxWindowID id,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- int n = 0, const wxString choices[] = (wxString *) NULL,
- long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxChoiceNameStr );
-
- void Append( const wxString &item );
- void Append( const wxString &item, void* clientData );
- void Append( const wxString &item, wxClientData* clientData );
-
- void SetClientData( int n, void* clientData );
- void* GetClientData( int n );
- void SetClientObject( int n, wxClientData* clientData );
- wxClientData* GetClientObject( int n );
-
- void Clear();
- void Delete(int n);
-
- int FindString( const wxString &string ) const;
- int GetColumns() const;
- int GetSelection();
- wxString GetString( int n ) const;
- wxString GetStringSelection() const;
- int Number() const;
- void SetColumns( int n = 1 );
- void SetSelection( int n );
- void SetStringSelection( const wxString &string );
-
-// implementation
-
- wxList m_clientDataList;
- wxList m_clientObjectList;
-
- void AppendCommon( const wxString &item );
- void ApplyWidgetStyle();
+ void Append( const wxString &item );
+ void Append( const wxString &item, void* clientData );
+ void Append( const wxString &item, wxClientData* clientData );
+
+ void SetClientData( int n, void* clientData );
+ void* GetClientData( int n );
+ void SetClientObject( int n, wxClientData* clientData );
+ wxClientData* GetClientObject( int n );
+
+ void Clear();
+ void Delete(int n);
+
+ int FindString( const wxString &string ) const;
+ int GetColumns() const;
+ int GetSelection();
+ wxString GetString( int n ) const;
+ wxString GetStringSelection() const;
+ int Number() const;
+ void SetColumns( int n = 1 );
+ void SetSelection( int n );
+ void SetStringSelection( const wxString &string );
+
+ // implementation
+
+ wxList m_clientDataList;
+ wxList m_clientObjectList;
+
+ void AppendCommon( const wxString &item );
+ void ApplyWidgetStyle();
};
#endif // __GTKCHOICEH__
-/////////////////////////////////////////////////////////////////////////////
-// Name: setup.h
-// Purpose: Configuration for the library
-// Author: Julian Smart
-// Modified by:
-// Created: 17/09/98
-// RCS-ID: $Id$
-// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _WX_SETUP_H_
-#define _WX_SETUP_H_
-
-/*
- * General features
+/* ./include/wx/motif/setup.h. Generated automatically by configure. */
+/* setup.h
+
+ Do not edit this file. It is autogenerated by configure.
+
+ Leave the following blank line there!! Autoheader needs it. */
+\f
+
+/* ------------------------------------------------------------------------ */
+/* Features as requested by configure */
+/* ------------------------------------------------------------------------ */
+
+#ifndef __GTKSETUPH__
+#define __GTKSETUPH__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+/* define the system to compile */
+#define __UNIX__ 1
+#define __LINUX__ 1
+/* #undef __SGI__ */
+/* #undef __HPUX__ */
+/* #undef __SYSV__ */
+/* #undef __SVR4__ */
+/* #undef __AIX__ */
+/* #undef __SUN__ */
+/* #undef __SOLARIS__ */
+/* #undef __SUNOS__ */
+/* #undef __ALPHA__ */
+/* #undef __OSF__ */
+/* #undef __BSD__ */
+/* #undef __FREEBSD__ */
+/* #undef __VMS__ */
+/* #undef __ULTRIX__ */
+/* #undef __DATA_GENERAL__ */
+
+/* ------------------------------------------------------------------------ */
+/* compiler options */
+/* ------------------------------------------------------------------------ */
+
+/*
+ * Supports bool type
+ */
+#define HAVE_BOOL 1
+
+/* ------------------------------------------------------------------------ */
+/* library options */
+/* ------------------------------------------------------------------------ */
+
+/*
+ * Use zlib
+ */
+#define wxUSE_ZLIB 1
+/*
+ * Use libpng
+ */
+#define wxUSE_LIBPNG 1
+/*
+ * Use libjpeg
+ */
+#define wxUSE_LIBJPEG 0
+/*
+ * Use iODBC
+ */
+#define wxUSE_ODBC 0
+/*
+ * Use Threads
+ */
+#define wxUSE_THREADS 1
+/*
+ * Have glibc2
+ */
+#define wxHAVE_GLIBC2 1
+/*
+ * Use libXpm
+ */
+#define wxHAVE_LIB_XPM 0
+
+/* ------------------------------------------------------------------------ */
+/* GUI control options (always enabled in wxGTK) */
+/* ------------------------------------------------------------------------ */
+/*
+ * Use gauge item
+ */
+#define wxUSE_GAUGE 1
+/*
+ * Use combobox item
+ */
+#define wxUSE_COMBOBOX 1
+/*
+ * Use scrollbar item
+ */
+#define wxUSE_SCROLLBAR 1
+/*
+ * Use scrollbar item
+ */
+#define wxUSE_RADIOBUTTON 1
+/*
+ * Use toolbar item
+ */
+#define wxUSE_TOOLBAR 1
+
+/* ------------------------------------------------------------------------ */
+/* non-GUI options */
+/* ------------------------------------------------------------------------ */
+
+/*
+ * Use time and date classes
+ */
+#define wxUSE_TIMEDATE 1
+/*
+ * Use config system
+ */
+#define wxUSE_CONFIG 1
+/*
+ * Use intl system
+ */
+#define wxUSE_INTL 1
+/*
+ * Use streams
+ */
+#define wxUSE_STREAMS 1
+/*
+ * Use class serialization
+ */
+#define wxUSE_SERIAL 0
+/*
+ * Use sockets
+ */
+#define wxUSE_SOCKETS 1
+/*
+ * Use standard C++ streams if 1. If 0, use wxWin
+ * streams implementation.
+ */
+#define wxUSE_STD_IOSTREAM 1
+/*
+ * Use constraints mechanism
+ */
+#define wxUSE_CONSTRAINTS 1
+
+/* ------------------------------------------------------------------------ */
+/* PS options */
+/* ------------------------------------------------------------------------ */
+
+/*
+ * Use font metric files in GetTextExtent for wxPostScriptDC
+ * Use consistent PostScript fonts for AFM and printing (!)
+ */
+#define wxUSE_AFM_FOR_POSTSCRIPT 1
+#define WX_NORMALIZED_PS_FONTS 1
+/*
+ * Use PostScript device context
+ */
+#define wxUSE_POSTSCRIPT 1
+
+/* ------------------------------------------------------------------------ */
+/* wxString options */
+/* ------------------------------------------------------------------------ */
+
+/*
+ * Compile wxString with wide character (Unicode) support?
+ */
+#define wxUSE_UNICODE 1
+
+/*
+ * Work around a bug in GNU libc 5.x wcstombs() implementation.
*
+ * Note that you must link your programs with libc.a if you enable this and you
+ * have libc 5 (you should enable this for libc6 where wcsrtombs() is
+ * thread-safe version of wcstombs()).
*/
+#define wxUSE_WCSRTOMBS 0
-#define wxUSE_CONSTRAINTS 1
- // Use constraints mechanism
-#define wxUSE_CONFIG 1
- // Use wxConfig, with CreateConfig in wxApp
-#define WXWIN_COMPATIBILITY 0
- // Minor compatibility with 1.68 API.
- // 1: on 0: off.
-
-#define wxUSE_POSTSCRIPT 1
- // 0 for no PostScript device context
-#define wxUSE_AFM_FOR_POSTSCRIPT 0
- // 1 to use font metric files in GetTextExtent
-#define wxUSE_METAFILE 1
- // 0 for no Metafile and metafile device context
-#define wxUSE_IPC 1
- // 0 for no interprocess comms
-#define wxUSE_HELP 1
- // 0 for no help facility
-#define wxUSE_RESOURCES 1
- // 0 for no wxGetResource/wxWriteResource
-#define wxUSE_CLIPBOARD 1
- // 0 for no clipboard functions
-#define wxUSE_SPLINES 1
- // 0 for no splines
-#define wxUSE_XFIG_SPLINE_CODE 1
- // 1 for XFIG spline code, 0 for AIAI spline code.
-// AIAI spline code is slower, but freer of copyright issues.
- // 0 for no splines
-
-#define wxUSE_XPM 1
- // Use XPMs
-
-#define wxUSE_TOOLBAR 1
- // Use toolbars
-#define wxUSE_COMBOBOX 1
- // Use wxComboBox
+/*
+ * On some platforms overloading on size_t/int doesn't work, yet we'd like
+ * to define both size_t and int version of wxString::operator[] because it
+ * should really be size_t, but a lot of old, broken code uses int indices.
+ */
+#define wxUSE_SIZE_T_STRING_OPERATOR 1
+
+/* ------------------------------------------------------------------------ */
+/* misc options */
+/* ------------------------------------------------------------------------ */
+
+/*
+ * Use Interprocess communication
+ */
+#define wxUSE_IPC 1
+/*
+ * Use wxGetResource & wxWriteResource (change .Xdefaults)
+ */
+#define wxUSE_RESOURCES 1
+/*
+ * Use clipboard
+ */
+#define wxUSE_CLIPBOARD 1
+/*
+ * Use tooltips
+ */
+#define wxUSE_TOOLTIPS 1
+/*
+ * Use dnd
+ */
#define wxUSE_DRAG_AND_DROP 1
- // 0 for no drag and drop
+/*
+ * Use wxLibrary class
+ */
+#define wxUSE_DYNLIB_CLASS 0
-#define wxUSE_WX_RESOURCES 1
- // Use .wxr resource mechanism (requires PrologIO library)
+/* ------------------------------------------------------------------------ */
+/* architecture options */
+/* ------------------------------------------------------------------------ */
+/*
+ * Use the mdi architecture
+ */
+#define wxUSE_MDI_ARCHITECTURE 1
+/*
+ * Use the document/view architecture
+ */
#define wxUSE_DOC_VIEW_ARCHITECTURE 1
- // Set to 0 to disable document/view architecture
-#define wxUSE_PRINTING_ARCHITECTURE 1
- // Set to 0 to disable print/preview architecture code
-#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 1
- // Set to 0 to disable PostScript print/preview architecture code
- // under Windows (just use Windows printing).
-#define wxUSE_DYNAMIC_CLASSES 1
- // If 1, enables provision of run-time type information.
- // NOW MANDATORY: don't change.
-#define wxUSE_MEMORY_TRACING 1
- // If 1, enables debugging versions of wxObject::new and
- // wxObject::delete *IF* __WXDEBUG__ is also defined.
- // WARNING: this code may not work with all architectures, especially
- // if alignment is an issue.
-#define wxUSE_DEBUG_CONTEXT 1
- // If 1, enables wxDebugContext, for
- // writing error messages to file, etc.
- // If WXDEBUG is not defined, will still use
- // normal memory operators.
- // It's recommended to set this to 1,
- // since you may well need to output
- // an error log in a production
- // version (or non-debugging beta)
-
-#define wxUSE_GLOBAL_MEMORY_OPERATORS 1
- // In debug mode, cause new and delete to be redefined globally.
- // If this causes problems (e.g. link errors), set this to 0.
+/*
+ * Use the print/preview architecture
+ */
+#define wxUSE_PRINTING_ARCHITECTURE 1
-#define wxUSE_DEBUG_NEW_ALWAYS 1
- // In debug mode, causes new to be defined to
- // be WXDEBUG_NEW (see object.h).
- // If this causes problems (e.g. link errors), set this to 0.
+/* ------------------------------------------------------------------------ */
+/* Prolog and wxWindows' resource system options */
+/* ------------------------------------------------------------------------ */
+
+/*
+ * Use Prolog IO
+ */
+#define wxUSE_PROLOGIO 1
+/*
+ * Use Remote Procedure Call (Needs wxUSE_IPC and wxUSE_PROLOGIO)
+ */
+#define wxUSE_RPC 0
+/*
+ * Use wxWindows resource loading (.wxr-files) (Needs wxUSE_PROLOGIO 1)
+ */
+#define wxUSE_WX_RESOURCES 1
+
+/* ------------------------------------------------------------------------ */
+/* the rest */
+/* ------------------------------------------------------------------------ */
+/*
+ * Use wxWindows help facility (needs wxUSE_IPC 1)
+ */
+#define wxUSE_HELP 1
+/*
+ * Use iostream.h rather than iostream
+ */
+#define wxUSE_IOSTREAMH 1
+/*
+ * Use Apple Ieee-double converter
+ */
+#define wxUSE_APPLE_IEEE 1
+/* Compatibility with 1.66 API.
+ Level 0: no backward compatibility, all new features
+ Level 1: wxDC, OnSize (etc.) compatibility, but
+ some new features such as event tables */
+#define WXWIN_COMPATIBILITY 0
+/*
+ * Enables debugging: memory tracing, assert, etc., contains debug level
+ */
+#define WXDEBUG 1
+/*
+ * Enables debugging version of wxObject::new and wxObject::delete (IF WXDEBUG)
+ * WARNING: this code may not work with all architectures, especially
+ * if alignment is an issue.
+ */
+#define wxUSE_MEMORY_TRACING 0
+/*
+ * Enable debugging version of global memory operators new and delete
+ * Disable it, If this causes problems (e.g. link errors)
+ */
+#define wxUSE_DEBUG_NEW_ALWAYS 1
+/*
+ * In debug mode, causes new to be defined to
+ * be WXDEBUG_NEW (see object.h). If this causes
+ * problems (e.g. link errors), set this to 0.
+ */
+#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
+/*
+ * Matthews garbage collection (used for MrEd?)
+ */
+#define WXGARBAGE_COLLECTION_ON 0
+/*
+ * Use splines
+ */
+#define wxUSE_SPLINES 1
+/*
+ * wxUSE_DYNAMIC_CLASSES is TRUE for the Xt port
+ */
+#define wxUSE_DYNAMIC_CLASSES 1
+/*
+ * Disable this if your compiler can't cope
+ * with omission of prototype parameters.
+ */
#define REMOVE_UNUSED_ARG 1
- // Set this to 0 if your compiler can't cope
- // with omission of prototype parameters.
+/*
+ * The const keyword is being introduced more in wxWindows.
+ * You can use this setting to maintain backward compatibility.
+ * If 0: will use const wherever possible.
+ * If 1: will use const only where necessary
+ * for precompiled headers to work.
+ * If 2: will be totally backward compatible, but precompiled
+ * headers may not work and program size will be larger.
+ */
+#define CONST_COMPATIBILITY 0
-#define wxUSE_C_MAIN 0
- // Set to 1 to use main.c instead of main.cpp (UNIX only)
+/* ------------------------------------------------------------------------ */
+/* System-specific stuff */
+/* ------------------------------------------------------------------------ */
-#define wxUSE_ODBC 0
- // Define 1 to use ODBC classes
+/* acconfig.h
+ This file is in the public domain.
-#define wxUSE_IOSTREAMH 1
- // VC++ 4.2 and above allows <iostream> and <iostream.h>
- // but you can't mix them. Set to 1 for <iostream.h>,
- // 0 for <iostream>
+ Descriptive text for the C preprocessor macros that
+ the distributed Autoconf macros can define.
+ No software package will use all of them; autoheader copies the ones
+ your configure.in uses into your configuration header file templates.
-#define wxUSE_WXCONFIG 1
- // if enabled, compiles built-in OS independent wxConfig
- // class and it's file (any platform) and registry (Win)
- // based implementations
+ The entries are in sort -df order: alphabetical, case insensitive,
+ ignoring punctuation (such as underscores). Although this order
+ can split up related entries, it makes it easier to check whether
+ a given entry is in the file. */
-#define wxUSE_GADGETS 0
- // Use gadgets where possible
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+/* #undef _ALL_SOURCE */
+#endif
-#define wxUSE_TIMEDATE 1
- // Use time and date
+/* Define if using alloca.c. */
+/* #undef C_ALLOCA */
-#define wxUSE_THREADS 0
- // Use threads
+/* Define if type char is unsigned and you are not using gcc. */
+#ifndef __CHAR_UNSIGNED__
+/* #undef __CHAR_UNSIGNED__ */
+#endif
-#define wxUSE_ZLIB 1
- // Use zlib for compression in streams and PNG code
-#define wxUSE_LIBPNG 1
- // Use PNG bitmap code
-#define wxUSE_STD_IOSTREAM 1
- // Use standard C++ streams if 1. If 0, use wxWin
- // streams implementation.
-#define wxUSE_STREAMS 1
- // Use wxStream implementation within wxWindows code
+/* Define if the closedir function returns void instead of int. */
+/* #undef CLOSEDIR_VOID */
-#define wxUSE_SERIAL 0
- // Use serialization (requires utils/serialize)
+/* Define to empty if the keyword does not work. */
+/* #undef const */
-#define wxUSE_TOOLTIPS 0
- // Use tooltips
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+/* #undef CRAY_STACKSEG_END */
-#define wxUSE_DYNLIB_CLASS 0
- // Use wxLibrary
-#define wxUSE_SOCKETS 1
- // Set to 1 to use socket classes
+/* Define for DGUX with <sys/dg_sys_info.h>. */
+/* #undef DGUX */
-/*
- * Finer detail
- *
- */
+/* Define if you have <dirent.h>. */
+/* #undef DIRENT */
+
+/* Define to the type of elements in the array set by `getgroups'.
+ Usually this is either `int' or `gid_t'. */
+#define GETGROUPS_T gid_t
+
+/* The type of 3rd argument to getsockname() - usually size_t or int */
+#define SOCKLEN_T size_t
+
+/* Define if the `getloadavg' function needs to be run setuid or setgid. */
+/* #undef GETLOADAVG_PRIVILEGED */
+
+/* Define if the `getpgrp' function takes no argument. */
+/* #undef GETPGRP_VOID */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef gid_t */
+
+/* Define if you have alloca, as a function or macro. */
+/* #undef HAVE_ALLOCA */
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define if you don't have vprintf but do have _doprnt. */
+/* #undef HAVE_DOPRNT */
+
+/* Define if you have sched.h */
+#define HAVE_SCHED_H 1
+
+/* Define if you have strings.h */
+#define HAVE_STRINGS_H 1
+
+/* Define if you have vprintf() */
+#define HAVE_VPRINTF 1
+
+/* Define if you have dlopen() */
+/* #undef HAVE_DLOPEN */
+
+/* Define if you have shl_load() */
+/* #undef HAVE_SHL_LOAD */
+
+/* Define if you have vsnprintf() */
+#define HAVE_VSNPRINTF 1
+
+/* Define if you have usleep() */
+/* #undef HAVE_USLEEP */
+
+/* Define if you have nanosleep() */
+#define HAVE_NANOSLEEP 1
+
+/* Define if you have vfork() */
+#define HAVE_VFORK 1
+
+/* Define if you have uname() */
+#define HAVE_UNAME 1
+
+/* Define if you have gethostname() */
+/* #undef HAVE_GETHOSTNAME */
+
+/* Define if you have sched_yield */
+#define HAVE_SCHED_YIELD 1
+
+/* Define if you have pthread_cancel */
+#define HAVE_PTHREAD_CANCEL 1
+
+/* Define if you have all functions to set thread priority */
+#define HAVE_THREAD_PRIORITY_FUNCTIONS 1
+
+/* Define if your system has its own `getloadavg' function. */
+/* #undef HAVE_GETLOADAVG */
+
+/* Define if you have the getmntent function. */
+/* #undef HAVE_GETMNTENT */
+
+/* Define if the `long double' type works. */
+#define HAVE_LONG_DOUBLE 1
+
+/* Define if you support file names longer than 14 characters. */
+#define HAVE_LONG_FILE_NAMES 1
+
+/* Define if you have a working `mmap' system call. */
+/* #undef HAVE_MMAP */
+
+/* Define if system calls automatically restart after interruption
+ by a signal. */
+/* #undef HAVE_RESTARTABLE_SYSCALLS */
-#define wxUSE_APPLE_IEEE 1
- // if enabled, the float codec written by Apple
- // will be used to write, in a portable way,
- // float on the disk
+/* Define if your struct stat has st_blksize. */
+#define HAVE_ST_BLKSIZE 1
+/* Define if your struct stat has st_blocks. */
+#define HAVE_ST_BLOCKS 1
+
+/* Define if you have the strcoll function and it is properly defined. */
+/* #undef HAVE_STRCOLL */
+
+/* Define if your struct stat has st_rdev. */
+#define HAVE_ST_RDEV 1
+
+/* Define if you have the strftime function. */
+/* #undef HAVE_STRFTIME */
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define if your struct tm has tm_zone. */
+#define HAVE_TM_ZONE 1
+
+/* Define if you don't have tm_zone but do have the external array
+ tzname. */
+/* #undef HAVE_TZNAME */
+
+/* Define if you have <unistd.h>. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have <fnmatch.h>. */
+#define HAVE_FNMATCH_H 1
+
+/* Define if utime(file, NULL) sets file's timestamp to the present. */
+/* #undef HAVE_UTIME_NULL */
+
+/* Define if you have <vfork.h>. */
+/* #undef HAVE_VFORK_H */
+
+/* Define if you have the vprintf function. */
+#define HAVE_VPRINTF 1
+
+/* Define if you have the wait3 system call. */
+/* #undef HAVE_WAIT3 */
+
+/* Define as __inline if that's what the C compiler calls it. */
+#ifndef __cplusplus
+/* #undef inline */
#endif
- // _WX_SETUP_H_
+
+/* Define if major, minor, and makedev are declared in <mkdev.h>. */
+/* #undef MAJOR_IN_MKDEV */
+
+/* Define if major, minor, and makedev are declared in <sysmacros.h>. */
+/* #undef MAJOR_IN_SYSMACROS */
+
+/* Define if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef mode_t */
+
+/* Define if you don't have <dirent.h>, but have <ndir.h>. */
+/* #undef NDIR */
+
+/* Define if you have <memory.h>, and <string.h> doesn't declare the
+ mem* functions. */
+/* #undef NEED_MEMORY_H */
+
+/* Define if your struct nlist has an n_un member. */
+/* #undef NLIST_NAME_UNION */
+
+/* Define if you have <nlist.h>. */
+/* #undef NLIST_STRUCT */
+
+/* Define if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef pid_t */
+
+/* Define if the system does not provide POSIX.1 features except
+ with this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define if you need to in order for stat and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define as the return type of signal handlers (int or void). */
+#define RETSIGTYPE void
+
+/* Define if the setvbuf function takes the buffering type as its second
+ argument and the buffer pointer as the third, as on System V
+ before release 3. */
+/* #undef SETVBUF_REVERSED */
+
+/* Define SIZESOF for some Objects */
+#define SIZEOF_INT 4
+#define SIZEOF_INT_P 4
+#define SIZEOF_LONG 4
+#define SIZEOF_LONG_LONG 8
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+/* #undef STACK_DIRECTION */
+
+/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define on System V Release 4. */
+/* #undef SVR4 */
+
+/* Define on BSD */
+/* #undef BSD */
+
+/* Define on System V */
+/* #undef SYSV */
+
+/* Define if you don't have <dirent.h>, but have <sys/dir.h>. */
+/* #undef SYSDIR */
+
+/* Define if you don't have <dirent.h>, but have <sys/ndir.h>. */
+/* #undef SYSNDIR */
+
+/* Define if `sys_siglist' is declared by <signal.h>. */
+/* #undef SYS_SIGLIST_DECLARED */
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define if your <sys/time.h> declares struct tm. */
+/* #undef TM_IN_SYS_TIME */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef uid_t */
+
+/* Define for Encore UMAX. */
+/* #undef UMAX */
+
+/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
+ instead of <sys/cpustats.h>. */
+/* #undef UMAX4_3 */
+
+/* Define if you do not have <strings.h>, index, bzero, etc.. */
+/* #undef USG */
+
+/* Define if the system is System V Release 4 */
+/* #undef SVR4 */
+
+/* Define vfork as fork if vfork does not work. */
+/* #undef vfork */
+
+/* Define if the closedir function returns void instead of int. */
+/* #undef VOID_CLOSEDIR */
+
+/* Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define if lex declares yytext as a char * by default, not a char[]. */
+#define YYTEXT_POINTER 1
+
+#endif /* __GTKSETUPH__ */
+
+\f
+/* Leave that blank line there!! Autoheader needs it.
+ If you're adding to this file, keep in mind:
+ The entries are in sort -df order: alphabetical, case insensitive,
+ ignoring punctuation (such as underscores). */
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
/*
* Property text edit control
*/
-
+
IMPLEMENT_CLASS(wxPropertyTextEdit, wxTextCtrl)
wxPropertyTextEdit::wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent,
const wxWindowID id, const wxString& value,
- const wxPoint& pos, const wxSize& size,
+ const wxPoint& pos, const wxSize& size,
long style, const wxString& name):
wxTextCtrl(parent, id, value, pos, size, style, wxDefaultValidator, name)
{
IMPLEMENT_DYNAMIC_CLASS(wxPropertyListView, wxPropertyView)
BEGIN_EVENT_TABLE(wxPropertyListView, wxPropertyView)
- EVT_BUTTON(wxID_OK, wxPropertyListView::OnOk)
- EVT_BUTTON(wxID_CANCEL, wxPropertyListView::OnCancel)
- EVT_BUTTON(wxID_HELP, wxPropertyListView::OnHelp)
- EVT_BUTTON(wxID_PROP_CROSS, wxPropertyListView::OnCross)
- EVT_BUTTON(wxID_PROP_CHECK, wxPropertyListView::OnCheck)
- EVT_BUTTON(wxID_PROP_EDIT, wxPropertyListView::OnEdit)
- EVT_TEXT_ENTER(wxID_PROP_TEXT, wxPropertyListView::OnText)
- EVT_LISTBOX(wxID_PROP_SELECT, wxPropertyListView::OnPropertySelect)
- EVT_COMMAND(wxID_PROP_SELECT, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxPropertyListView::OnPropertyDoubleClick)
- EVT_LISTBOX(wxID_PROP_VALUE_SELECT, wxPropertyListView::OnValueListSelect)
+ EVT_BUTTON(wxID_OK, wxPropertyListView::OnOk)
+ EVT_BUTTON(wxID_CANCEL, wxPropertyListView::OnCancel)
+ EVT_BUTTON(wxID_HELP, wxPropertyListView::OnHelp)
+ EVT_BUTTON(wxID_PROP_CROSS, wxPropertyListView::OnCross)
+ EVT_BUTTON(wxID_PROP_CHECK, wxPropertyListView::OnCheck)
+ EVT_BUTTON(wxID_PROP_EDIT, wxPropertyListView::OnEdit)
+ EVT_TEXT_ENTER(wxID_PROP_TEXT, wxPropertyListView::OnText)
+ EVT_LISTBOX(wxID_PROP_SELECT, wxPropertyListView::OnPropertySelect)
+ EVT_COMMAND(wxID_PROP_SELECT, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
+ wxPropertyListView::OnPropertyDoubleClick)
+ EVT_LISTBOX(wxID_PROP_VALUE_SELECT, wxPropertyListView::OnValueListSelect)
END_EVENT_TABLE()
bool wxPropertyListView::sm_dialogCancelled = FALSE;
{
// Don't update the listbox unnecessarily because it can cause
// ugly flashing.
-
+
if (paddedString != m_propertyScrollingList->GetString(sel))
m_propertyScrollingList->SetString(sel, paddedString.GetData());
}
smallButtonWidth = -1;
smallButtonHeight = -1;
#endif
-
+
if (m_valueText)
return TRUE;
-
+
if (!panel)
return FALSE;
c2->left.SameAs (panel, wxLeft, 2);
else
c2->left.RightOf (leftMostWindow, 2);
-
+
c2->bottom.SameAs (panel, wxBottom, 2);
c2->width.AsIs();
c2->height.AsIs();
m_valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "", wxPoint(-1, -1), wxSize(-1, -1), wxPROCESS_ENTER);
m_valueText->Enable(FALSE);
-
+
wxLayoutConstraints *c = new wxLayoutConstraints;
if (m_cancelButton)
// Retrieve the value if any
wxCommandEvent event;
OnCheck(event);
-
+
delete this;
return TRUE;
}
{
// Retrieve the value if any
OnCheck(event);
-
+
m_managedWindow->Close(TRUE);
}
/*
* Property dialog box
*/
-
+
IMPLEMENT_CLASS(wxPropertyListDialog, wxDialog)
BEGIN_EVENT_TABLE(wxPropertyListDialog, wxDialog)
- EVT_BUTTON(wxID_CANCEL, wxPropertyListDialog::OnCancel)
+ EVT_BUTTON(wxID_CANCEL, wxPropertyListDialog::OnCancel)
EVT_CLOSE(wxPropertyListDialog::OnCloseWindow)
END_EVENT_TABLE()
wxPropertyListDialog::wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent,
- const wxString& title, const wxPoint& pos,
+ const wxString& title, const wxPoint& pos,
const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name)
{
{
if (m_view)
{
- SetReturnCode(wxID_CANCEL);
+ SetReturnCode(wxID_CANCEL);
m_view->OnClose();
- m_view = NULL;
- this->Destroy();
+ m_view = NULL;
+ this->Destroy();
}
else
{
void wxPropertyListDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
{
- SetReturnCode(wxID_CANCEL);
+ SetReturnCode(wxID_CANCEL);
this->Close();
}
// Extend event processing to search the view's event table
bool wxPropertyListDialog::ProcessEvent(wxEvent& event)
{
- if ( !m_view || ! m_view->ProcessEvent(event) )
- return wxEvtHandler::ProcessEvent(event);
- else
- return TRUE;
+ if ( !m_view || ! m_view->ProcessEvent(event) )
+ return wxEvtHandler::ProcessEvent(event);
+ else
+ return TRUE;
}
/*
* Property panel
*/
-
+
IMPLEMENT_CLASS(wxPropertyListPanel, wxPanel)
BEGIN_EVENT_TABLE(wxPropertyListPanel, wxPanel)
// Extend event processing to search the view's event table
bool wxPropertyListPanel::ProcessEvent(wxEvent& event)
{
- if ( !m_view || ! m_view->ProcessEvent(event) )
- return wxEvtHandler::ProcessEvent(event);
- else
- return TRUE;
+ if ( !m_view || ! m_view->ProcessEvent(event) )
+ return wxEvtHandler::ProcessEvent(event);
+ else
+ return TRUE;
}
void wxPropertyListPanel::OnSize(wxSizeEvent& WXUNUSED(event))
/*
* Property frame
*/
-
+
IMPLEMENT_CLASS(wxPropertyListFrame, wxFrame)
BEGIN_EVENT_TABLE(wxPropertyListFrame, wxFrame)
/*
* Property list specific validator
*/
-
+
IMPLEMENT_ABSTRACT_CLASS(wxPropertyListValidator, wxPropertyValidator)
bool wxPropertyListValidator::OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow)
///
/// Real number validator
-///
+///
bool wxRealListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *parentWindow)
{
if (m_realMin == 0.0 && m_realMax == 0.0)
return TRUE;
-
+
if (!view->GetValueText())
return FALSE;
wxString value(view->GetValueText()->GetValue());
wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
-
+
if (val < m_realMin || val > m_realMax)
{
char buf[200];
if (strlen(view->GetValueText()->GetValue()) == 0)
return FALSE;
-
+
wxString value(view->GetValueText()->GetValue());
float f = (float)atof(value.GetData());
property->GetValue() = f;
///
/// Integer validator
-///
+///
IMPLEMENT_DYNAMIC_CLASS(wxIntegerListValidator, wxPropertyListValidator)
bool wxIntegerListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropertyListView *view, wxWindow *parentWindow)
{
if (m_integerMin == 0 && m_integerMax == 0)
return TRUE;
-
+
if (!view->GetValueText())
return FALSE;
wxString value(view->GetValueText()->GetValue());
if (strlen(view->GetValueText()->GetValue()) == 0)
return FALSE;
-
+
wxString value(view->GetValueText()->GetValue());
long val = (long)atoi(value.GetData());
property->GetValue() = (long)val;
if (strlen(view->GetValueText()->GetValue()) == 0)
return FALSE;
-
+
wxString value(view->GetValueText()->GetValue());
bool boolValue = FALSE;
if (value == "True")
{
view->ShowListBoxControl(TRUE);
view->GetValueList()->Enable(TRUE);
-
+
view->GetValueList()->Append("True");
view->GetValueList()->Append("False");
char *currentString = copystring(view->GetValueText()->GetValue());
///
/// String validator
-///
+///
IMPLEMENT_DYNAMIC_CLASS(wxStringListValidator, wxPropertyListValidator)
wxStringListValidator::wxStringListValidator(wxStringList *list, long flags):
view->GetValueText()->Enable(TRUE);
return TRUE;
}
-
+
// Constrained
if (view->GetValueText())
view->GetValueText()->Enable(FALSE);
///
/// Filename validator
-///
+///
IMPLEMENT_DYNAMIC_CLASS(wxFilenameListValidator, wxPropertyListValidator)
wxFilenameListValidator::wxFilenameListValidator(wxString message , wxString wildcard, long flags):
///
/// Colour validator
-///
+///
IMPLEMENT_DYNAMIC_CLASS(wxColourListValidator, wxPropertyListValidator)
wxColourListValidator::wxColourListValidator(long flags):
if (!view->GetValueText())
return FALSE;
wxString value(view->GetValueText()->GetValue());
-
+
property->GetValue() = value ;
return TRUE;
}
{
if (!view->GetValueText())
return;
-
+
char *s = property->GetValue().StringValue();
int r = 0;
int g = 0;
g = wxHexToDec(s+2);
b = wxHexToDec(s+4);
}
-
+
wxColour col(r,g,b);
-
+
wxColourData data;
data.SetChooseFull(TRUE);
data.SetColour(col);
-
+
for (int i = 0; i < 16; i++)
{
wxColour colour(i*16, i*16, i*16);
data.SetCustomColour(i, colour);
}
-
+
wxColourDialog dialog(parentWindow, &data);
if (dialog.ShowModal() != wxID_CANCEL)
{
wxColourData retData = dialog.GetColourData();
col = retData.GetColour();
-
+
char buf[7];
wxDecToHex(col.Red(), buf);
wxDecToHex(col.Green(), buf+2);
{
// Convert property value to a list of strings for editing
wxStringList *stringList = new wxStringList;
-
+
wxPropertyValue *expr = property->GetValue().GetFirst();
while (expr)
{
stringList->Add(s);
expr = expr->GetNext();
}
-
+
wxString title("Editing ");
title += property->GetName();
-
+
if (EditStringList(parentWindow, stringList, title.GetData()))
{
wxPropertyValue& oldValue = property->GetValue();
{
char *s = (char *)node->Data();
oldValue.Append(new wxPropertyValue(s));
-
+
node = node->Next();
}
-
+
view->DisplayProperty(property);
view->UpdatePropertyDisplayInList(property);
view->OnPropertyChanged(property);
{
public:
wxPropertyStringListEditorDialog(wxWindow *parent, const wxString& title,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = "stringEditorDialogBox"):
- wxDialog(parent, -1, title, pos, size, windowStyle, name)
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = "stringEditorDialogBox"):
+ wxDialog(parent, -1, title, pos, size, windowStyle, name)
{
m_stringList = NULL;
m_stringText = NULL;
void SaveCurrentSelection(void);
void ShowCurrentSelection(void);
- void OnOK(wxCommandEvent& event);
- void OnCancel(wxCommandEvent& event);
- void OnAdd(wxCommandEvent& event);
- void OnDelete(wxCommandEvent& event);
- void OnStrings(wxCommandEvent& event);
- void OnText(wxCommandEvent& event);
+ void OnOK(wxCommandEvent& event);
+ void OnCancel(wxCommandEvent& event);
+ void OnAdd(wxCommandEvent& event);
+ void OnDelete(wxCommandEvent& event);
+ void OnStrings(wxCommandEvent& event);
+ void OnText(wxCommandEvent& event);
public:
wxStringList* m_stringList;
DECLARE_EVENT_TABLE()
};
-#define wxID_PROP_SL_ADD 3000
-#define wxID_PROP_SL_DELETE 3001
-#define wxID_PROP_SL_STRINGS 3002
-#define wxID_PROP_SL_TEXT 3003
+#define wxID_PROP_SL_ADD 3000
+#define wxID_PROP_SL_DELETE 3001
+#define wxID_PROP_SL_STRINGS 3002
+#define wxID_PROP_SL_TEXT 3003
BEGIN_EVENT_TABLE(wxPropertyStringListEditorDialog, wxDialog)
- EVT_BUTTON(wxID_OK, wxPropertyStringListEditorDialog::OnOK)
- EVT_BUTTON(wxID_CANCEL, wxPropertyStringListEditorDialog::OnCancel)
- EVT_BUTTON(wxID_PROP_SL_ADD, wxPropertyStringListEditorDialog::OnAdd)
- EVT_BUTTON(wxID_PROP_SL_DELETE, wxPropertyStringListEditorDialog::OnDelete)
- EVT_LISTBOX(wxID_PROP_SL_STRINGS, wxPropertyStringListEditorDialog::OnStrings)
- EVT_TEXT_ENTER(wxID_PROP_SL_TEXT, wxPropertyStringListEditorDialog::OnText)
+ EVT_BUTTON(wxID_OK, wxPropertyStringListEditorDialog::OnOK)
+ EVT_BUTTON(wxID_CANCEL, wxPropertyStringListEditorDialog::OnCancel)
+ EVT_BUTTON(wxID_PROP_SL_ADD, wxPropertyStringListEditorDialog::OnAdd)
+ EVT_BUTTON(wxID_PROP_SL_DELETE, wxPropertyStringListEditorDialog::OnDelete)
+ EVT_LISTBOX(wxID_PROP_SL_STRINGS, wxPropertyStringListEditorDialog::OnStrings)
+ EVT_TEXT_ENTER(wxID_PROP_SL_TEXT, wxPropertyStringListEditorDialog::OnText)
EVT_CLOSE(wxPropertyStringListEditorDialog::OnCloseWindow)
END_EVENT_TABLE()
{
public:
wxPropertyStringListEditorText(wxWindow *parent, wxWindowID id, const wxString& val,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long windowStyle = 0, const wxString& name = "text"):
wxTextCtrl(parent, id, val, pos, size, windowStyle, wxDefaultValidator, name)
{
wxBeginBusyCursor();
wxPropertyStringListEditorDialog *dialog = new wxPropertyStringListEditorDialog(parent,
- title, wxPoint(10, 10), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
-
+ title, wxPoint(10, 10), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
+
dialog->m_stringList = stringList;
-
+
dialog->m_listBox = new wxListBox(dialog, wxID_PROP_SL_STRINGS,
wxPoint(-1, -1), wxSize(-1, -1), 0, NULL, wxLB_SINGLE);
dialog->Centre(wxBOTH);
wxEndBusyCursor();
if (dialog->ShowModal() == wxID_CANCEL)
- return FALSE;
+ return FALSE;
else
- return TRUE;
+ return TRUE;
}
/*
int sel = m_listBox->GetSelection();
if (sel == -1)
return;
-
+
wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel);
if (!node)
return;
-
+
m_listBox->Delete(sel);
delete[] (char *)node->Data();
delete node;
void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event))
{
SaveCurrentSelection();
-
+
char *initialText = "";
wxNode *node = m_stringList->Add(initialText);
m_listBox->Append(initialText, (char *)node);
{
if (m_currentSelection == -1)
return;
-
+
wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(m_currentSelection);
if (!node)
return;
-
+
wxString txt(m_stringText->GetValue());
if (node->Data())
delete[] (char *)node->Data();
node->SetData((wxObject *)copystring(txt));
-
+
m_listBox->SetString(m_currentSelection, (char *)node->Data());
}
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
{
- if (!choice->HasVMT()) return;
- if (g_blockEventsOnDrag) return;
-
+ if (!choice->HasVMT())
+ return;
+
+ if (g_blockEventsOnDrag)
+ return;
+
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
- wxString tmp( choice->GetStringSelection() );
- event.SetString( WXSTRINGCAST(tmp) );
+ event.SetString( choice->GetStringSelection() );
event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event);
}
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
-
+
PreCreation( parent, id, pos, size, style, name );
-
+
SetValidator( validator );
m_widget = gtk_option_menu_new();
-
- wxSize newSize = size;
- if (newSize.x == -1) newSize.x = 80;
- if (newSize.y == -1) newSize.y = 26;
+
+ wxSize newSize(size);
+ if (newSize.x == -1)
+ newSize.x = 80;
+ if (newSize.y == -1)
+ newSize.y = 26;
SetSize( newSize.x, newSize.y );
-
+
GtkWidget *menu = gtk_menu_new();
-
+
for (int i = 0; i < n; i++)
{
m_clientDataList.Append( (wxObject*) NULL );
m_clientObjectList.Append( (wxObject*) NULL );
-
+
GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
gtk_menu_append( GTK_MENU(menu), item );
-
+
gtk_widget_realize( item );
gtk_widget_realize( GTK_BIN(item)->child );
-
+
gtk_widget_show( item );
-
- gtk_signal_connect( GTK_OBJECT( item ), "activate",
+
+ gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
-
+
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
-
+
PostCreation();
-
+
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
SetFont( parent->GetFont() );
Show( TRUE );
-
+
return TRUE;
}
-
+
wxChoice::~wxChoice()
{
Clear();
void wxChoice::AppendCommon( const wxString &item )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
-
+
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu_item = gtk_menu_item_new_with_label( item );
-
+
gtk_menu_append( GTK_MENU(menu), menu_item );
-
+
gtk_widget_realize( menu_item );
gtk_widget_realize( GTK_BIN(menu_item)->child );
-
+
if (m_widgetStyle) ApplyWidgetStyle();
-
- gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
+
+ gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
-
+
gtk_widget_show( menu_item );
}
{
m_clientDataList.Append( (wxObject*) NULL );
m_clientObjectList.Append( (wxObject*) NULL );
-
+
AppendCommon( item );
}
{
m_clientDataList.Append( (wxObject*) clientData );
m_clientObjectList.Append( (wxObject*) NULL );
-
+
AppendCommon( item );
}
{
m_clientObjectList.Append( (wxObject*) clientData );
m_clientDataList.Append( (wxObject*) NULL );
-
+
AppendCommon( item );
}
void wxChoice::SetClientData( int n, void* clientData )
{
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
-
+
wxNode *node = m_clientDataList.Nth( n );
if (!node) return;
-
+
node->SetData( (wxObject*) clientData );
}
void* wxChoice::GetClientData( int n )
{
wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" );
-
+
wxNode *node = m_clientDataList.Nth( n );
if (!node) return NULL;
-
+
return node->Data();
}
void wxChoice::SetClientObject( int n, wxClientData* clientData )
{
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
-
+
wxNode *node = m_clientObjectList.Nth( n );
if (!node) return;
-
+
wxClientData *cd = (wxClientData*) node->Data();
if (cd) delete cd;
-
+
node->SetData( (wxObject*) clientData );
}
wxClientData* wxChoice::GetClientObject( int n )
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, "invalid combobox" );
-
+
wxNode *node = m_clientObjectList.Nth( n );
if (!node) return (wxClientData*) NULL;
-
+
return (wxClientData*) node->Data();
}
-
+
void wxChoice::Clear()
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu = gtk_menu_new();
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
-
+
wxNode *node = m_clientObjectList.First();
while (node)
{
node = node->Next();
}
m_clientObjectList.Clear();
-
+
m_clientDataList.Clear();
}
// If you read this code once and you think you understand
// it, then you are very wrong. Robert Roebling.
-
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
-
+
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
-
- if (string == label->label) return count;
+
+ if (string == label->label)
+ return count;
+
child = child->next;
count++;
}
-
- wxFAIL_MSG( "wxChoice: string not found" );
-
+
return -1;
}
child = child->next;
count++;
}
-
+
wxFAIL_MSG( "wxChoice: no selection" );
-
+
return -1;
}
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
-
+
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
-
+
return label->label;
}
child = child->next;
count++;
}
-
- wxFAIL_MSG( "wxChoice: string not found" );
-
+
+ wxFAIL_MSG( "wxChoice: invalid index in GetString()" );
+
return "";
}
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
-
+
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
-
+
return label->label;
}
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
-
+
gtk_choice_clicked_callback( (GtkWidget *) NULL, this );
}
void wxChoice::ApplyWidgetStyle()
{
SetWidgetStyle();
-
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
-
+
gtk_widget_set_style( m_widget, m_widgetStyle );
gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
-
+
GList *child = menu_shell->children;
while (child)
{
gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
-
+
GtkBin *bin = GTK_BIN( child->data );
GtkWidget *label = (GtkWidget *) NULL;
if (bin->child) label = bin->child;
if (!label) label = GTK_BUTTON(m_widget)->child;
-
+
gtk_widget_set_style( label, m_widgetStyle );
-
+
child = child->next;
}
}
#pragma implementation "combobox.h"
#endif
-
#include "wx/combobox.h"
#include <wx/intl.h>
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
event.SetInt( combo->GetSelection() );
- event.SetString( copystring(combo->GetStringSelection()) );
+ event.SetString( combo->GetStringSelection() );
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
-
- delete [] event.GetString();
}
//-----------------------------------------------------------------------------
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
- event.SetString( copystring(combo->GetValue()) );
+ event.SetString( combo->GetValue() );
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
-
- delete [] event.GetString();
}
//-----------------------------------------------------------------------------
// all!
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() );
event.SetInt( 0 );
- event.SetString( (char *)value.c_str() );
+ event.SetString( value );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
}
// and generate the selected event for it
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() );
event.SetInt( Number() - 1 );
- event.SetString( (char *)value.c_str() );
+ event.SetString( value );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
}
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
{
if (!rb->HasVMT()) return;
if (g_blockEventsOnDrag) return;
-
+
if (rb->m_alreadySent)
{
rb->m_alreadySent = FALSE;
}
rb->m_alreadySent = TRUE;
-
+
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
event.SetInt( rb->GetSelection() );
- wxString tmp( rb->GetStringSelection() );
- event.SetString( WXSTRINGCAST(tmp) );
+ event.SetString( rb->GetStringSelection() );
event.SetEventObject( rb );
rb->GetEventHandler()->ProcessEvent(event);
}
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
- int n, const wxString choices[], int majorDim,
- long style, const wxValidator& validator,
- const wxString &name )
+ int n, const wxString choices[], int majorDim,
+ long style, const wxValidator& validator,
+ const wxString &name )
{
m_alreadySent = FALSE;
m_needParent = TRUE;
m_acceptsFocus = TRUE;
-
+
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_frame_new( title );
-
+
m_majorDim = majorDim;
-
+
GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
-
+
GSList *radio_button_group = (GSList *) NULL;
for (int i = 0; i < n; i++)
{
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
-
+
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
-
+
m_boxes.Append( (wxObject*) m_radio );
-
+
ConnectWidget( GTK_WIDGET(m_radio) );
-
+
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
-
- gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
+
+ gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
-
+
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), m_x+10, m_y+10+(i*24) );
-
+
}
-
+
wxSize ls = LayoutItems();
-
+
wxSize newSize = size;
if (newSize.x == -1) newSize.x = ls.x;
if (newSize.y == -1) newSize.y = ls.y;
SetSize( newSize.x, newSize.y );
-
+
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
-
+
PostCreation();
-
+
SetLabel( title );
-
+
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
SetFont( parent->GetFont() );
Show( TRUE );
-
+
return TRUE;
}
void wxRadioBox::OnSize( wxSizeEvent &event )
{
wxControl::OnSize( event );
-
+
LayoutItems();
}
{
int x = 7;
int y = 15;
-
+
int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1;
-
+
wxSize res( 0, 0 );
-
+
if (m_windowStyle & wxRA_HORIZONTAL)
{
-
+
for (int j = 0; j < m_majorDim; j++)
- {
+ {
y = 15;
-
+
int max_len = 0;
wxNode *node = m_boxes.Nth( j*num_per_major );
- for (int i1 = 0; i1< num_per_major; i1++)
- {
+ for (int i1 = 0; i1< num_per_major; i1++)
+ {
GtkWidget *button = GTK_WIDGET( node->Data() );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
GdkFont *font = m_widget->style->font;
int len = 22+gdk_string_measure( font, label->label );
if (len > max_len) max_len = len;
-
+
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
y += 20;
-
- node = node->Next();
- if (!node) break;
- }
-
- // we don't know the max_len before
-
+
+ node = node->Next();
+ if (!node) break;
+ }
+
+ // we don't know the max_len before
+
node = m_boxes.Nth( j*num_per_major );
- for (int i2 = 0; i2< num_per_major; i2++)
- {
+ for (int i2 = 0; i2< num_per_major; i2++)
+ {
GtkWidget *button = GTK_WIDGET( node->Data() );
-
- gtk_widget_set_usize( button, max_len, 20 );
-
- node = node->Next();
- if (!node) break;
- }
-
- if (y > res.y) res.y = y;
-
- x += max_len + 2;
+
+ gtk_widget_set_usize( button, max_len, 20 );
+
+ node = node->Next();
+ if (!node) break;
+ }
+
+ if (y > res.y) res.y = y;
+
+ x += max_len + 2;
}
-
- res.x = x+4;
- res.y += 9;
+
+ res.x = x+4;
+ res.y += 9;
}
else
{
{
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *label = GTK_LABEL( button->child );
-
+
GdkFont *font = m_widget->style->font;
int len = 22+gdk_string_measure( font, label->label );
if (len > max) max = len;
-
+
node = node->Next();
}
-
+
node = m_boxes.First();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->Data() );
-
+
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
x += max;
gtk_widget_set_usize( button, max, 20 );
-
+
node = node->Next();
}
- res.x = x+4;
- res.y = 42;
+ res.x = x+4;
+ res.y = 42;
}
-
+
return res;
}
bool wxRadioBox::Show( bool show )
{
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
-
+
wxWindow::Show( show );
wxNode *node = m_boxes.First();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->Data() );
-
+
if (show) gtk_widget_show( button ); else gtk_widget_hide( button );
-
+
node = node->Next();
}
int wxRadioBox::FindString( const wxString &s ) const
{
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
-
+
int count = 0;
-
+
wxNode *node = m_boxes.First();
while (node)
{
GtkButton *button = GTK_BUTTON( node->Data() );
-
+
GtkLabel *label = GTK_LABEL( button->child );
if (s == label->label) return count;
count++;
-
+
node = node->Next();
}
-
+
return -1;
}
void wxRadioBox::SetFocus()
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
if (m_boxes.GetCount() == 0) return;
-
+
wxNode *node = m_boxes.First();
while (node)
{
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
if (button->active)
- {
+ {
gtk_widget_grab_focus( GTK_WIDGET(button) );
-
- return;
- }
+
+ return;
+ }
node = node->Next();
}
-
+
}
void wxRadioBox::SetSelection( int n )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( n );
-
+
wxCHECK_RET( node, "radiobox wrong index" );
-
+
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
-
+
gtk_toggle_button_set_state( button, 1 );
}
int wxRadioBox::GetSelection(void) const
{
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
-
+
int count = 0;
-
+
wxNode *node = m_boxes.First();
while (node)
{
count++;
node = node->Next();
}
-
+
wxFAIL_MSG( "wxRadioBox none selected" );
-
+
return -1;
}
wxString wxRadioBox::GetString( int n ) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( n );
-
+
wxCHECK_MSG( node, "", "radiobox wrong index" );
-
+
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *label = GTK_LABEL( button->child );
-
+
return wxString( label->label );
}
wxString wxRadioBox::GetLabel( int item ) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
-
+
return GetString( item );
}
void wxRadioBox::SetLabel( const wxString& label )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxControl::SetLabel( label );
-
+
gtk_frame_set_label( GTK_FRAME(m_widget), wxControl::GetLabel() );
}
void wxRadioBox::SetLabel( int item, const wxString& label )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( item );
-
+
wxCHECK_RET( node, "radiobox wrong index" );
-
+
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *g_label = GTK_LABEL( button->child );
-
+
gtk_label_set( g_label, label );
}
void wxRadioBox::Enable( bool enable )
{
wxControl::Enable( enable );
-
+
wxNode *node = m_boxes.First();
while (node)
{
void wxRadioBox::Enable( int item, bool enable )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( item );
-
+
wxCHECK_RET( node, "radiobox wrong index" );
-
+
GtkButton *button = GTK_BUTTON( node->Data() );
GtkWidget *label = button->child;
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
void wxRadioBox::Show( int item, bool show )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( item );
-
+
wxCHECK_RET( node, "radiobox wrong index" );
-
+
GtkWidget *button = GTK_WIDGET( node->Data() );
if (show)
wxString wxRadioBox::GetStringSelection(void) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
-
+
wxNode *node = m_boxes.First();
while (node)
{
}
node = node->Next();
}
-
+
wxFAIL_MSG( "wxRadioBox none selected" );
return "";
}
bool wxRadioBox::SetStringSelection( const wxString &s )
{
- wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
-
+ wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
+
int res = FindString( s );
if (res == -1) return FALSE;
SetSelection( res );
-
+
return TRUE;
}
void wxRadioBox::ApplyWidgetStyle()
{
SetWidgetStyle();
-
+
gtk_widget_set_style( m_widget, m_widgetStyle );
-
+
wxNode *node = m_boxes.First();
while (node)
{
GtkWidget *widget = GTK_WIDGET( node->Data() );
gtk_widget_set_style( widget, m_widgetStyle );
-
+
GtkButton *button = GTK_BUTTON( node->Data() );
gtk_widget_set_style( button->child, m_widgetStyle );
-
+
node = node->Next();
}
}
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{
if (window == m_widget->window) return TRUE;
-
+
wxNode *node = m_boxes.First();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->Data() );
-
+
if (window == button->window) return TRUE;
-
+
node = node->Next();
}
-
+
return FALSE;
}
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
{
- if (!choice->HasVMT()) return;
- if (g_blockEventsOnDrag) return;
-
+ if (!choice->HasVMT())
+ return;
+
+ if (g_blockEventsOnDrag)
+ return;
+
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
- wxString tmp( choice->GetStringSelection() );
- event.SetString( WXSTRINGCAST(tmp) );
+ event.SetString( choice->GetStringSelection() );
event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event);
}
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
-
+
PreCreation( parent, id, pos, size, style, name );
-
+
SetValidator( validator );
m_widget = gtk_option_menu_new();
-
- wxSize newSize = size;
- if (newSize.x == -1) newSize.x = 80;
- if (newSize.y == -1) newSize.y = 26;
+
+ wxSize newSize(size);
+ if (newSize.x == -1)
+ newSize.x = 80;
+ if (newSize.y == -1)
+ newSize.y = 26;
SetSize( newSize.x, newSize.y );
-
+
GtkWidget *menu = gtk_menu_new();
-
+
for (int i = 0; i < n; i++)
{
m_clientDataList.Append( (wxObject*) NULL );
m_clientObjectList.Append( (wxObject*) NULL );
-
+
GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
gtk_menu_append( GTK_MENU(menu), item );
-
+
gtk_widget_realize( item );
gtk_widget_realize( GTK_BIN(item)->child );
-
+
gtk_widget_show( item );
-
- gtk_signal_connect( GTK_OBJECT( item ), "activate",
+
+ gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
-
+
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
-
+
PostCreation();
-
+
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
SetFont( parent->GetFont() );
Show( TRUE );
-
+
return TRUE;
}
-
+
wxChoice::~wxChoice()
{
Clear();
void wxChoice::AppendCommon( const wxString &item )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
-
+
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu_item = gtk_menu_item_new_with_label( item );
-
+
gtk_menu_append( GTK_MENU(menu), menu_item );
-
+
gtk_widget_realize( menu_item );
gtk_widget_realize( GTK_BIN(menu_item)->child );
-
+
if (m_widgetStyle) ApplyWidgetStyle();
-
- gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
+
+ gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
-
+
gtk_widget_show( menu_item );
}
{
m_clientDataList.Append( (wxObject*) NULL );
m_clientObjectList.Append( (wxObject*) NULL );
-
+
AppendCommon( item );
}
{
m_clientDataList.Append( (wxObject*) clientData );
m_clientObjectList.Append( (wxObject*) NULL );
-
+
AppendCommon( item );
}
{
m_clientObjectList.Append( (wxObject*) clientData );
m_clientDataList.Append( (wxObject*) NULL );
-
+
AppendCommon( item );
}
void wxChoice::SetClientData( int n, void* clientData )
{
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
-
+
wxNode *node = m_clientDataList.Nth( n );
if (!node) return;
-
+
node->SetData( (wxObject*) clientData );
}
void* wxChoice::GetClientData( int n )
{
wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" );
-
+
wxNode *node = m_clientDataList.Nth( n );
if (!node) return NULL;
-
+
return node->Data();
}
void wxChoice::SetClientObject( int n, wxClientData* clientData )
{
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
-
+
wxNode *node = m_clientObjectList.Nth( n );
if (!node) return;
-
+
wxClientData *cd = (wxClientData*) node->Data();
if (cd) delete cd;
-
+
node->SetData( (wxObject*) clientData );
}
wxClientData* wxChoice::GetClientObject( int n )
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, "invalid combobox" );
-
+
wxNode *node = m_clientObjectList.Nth( n );
if (!node) return (wxClientData*) NULL;
-
+
return (wxClientData*) node->Data();
}
-
+
void wxChoice::Clear()
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu = gtk_menu_new();
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
-
+
wxNode *node = m_clientObjectList.First();
while (node)
{
node = node->Next();
}
m_clientObjectList.Clear();
-
+
m_clientDataList.Clear();
}
// If you read this code once and you think you understand
// it, then you are very wrong. Robert Roebling.
-
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
-
+
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
-
- if (string == label->label) return count;
+
+ if (string == label->label)
+ return count;
+
child = child->next;
count++;
}
-
- wxFAIL_MSG( "wxChoice: string not found" );
-
+
return -1;
}
child = child->next;
count++;
}
-
+
wxFAIL_MSG( "wxChoice: no selection" );
-
+
return -1;
}
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
-
+
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
-
+
return label->label;
}
child = child->next;
count++;
}
-
- wxFAIL_MSG( "wxChoice: string not found" );
-
+
+ wxFAIL_MSG( "wxChoice: invalid index in GetString()" );
+
return "";
}
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
-
+
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
-
+
return label->label;
}
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
-
+
gtk_choice_clicked_callback( (GtkWidget *) NULL, this );
}
void wxChoice::ApplyWidgetStyle()
{
SetWidgetStyle();
-
+
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
-
+
gtk_widget_set_style( m_widget, m_widgetStyle );
gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
-
+
GList *child = menu_shell->children;
while (child)
{
gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
-
+
GtkBin *bin = GTK_BIN( child->data );
GtkWidget *label = (GtkWidget *) NULL;
if (bin->child) label = bin->child;
if (!label) label = GTK_BUTTON(m_widget)->child;
-
+
gtk_widget_set_style( label, m_widgetStyle );
-
+
child = child->next;
}
}
#pragma implementation "combobox.h"
#endif
-
#include "wx/combobox.h"
#include <wx/intl.h>
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
event.SetInt( combo->GetSelection() );
- event.SetString( copystring(combo->GetStringSelection()) );
+ event.SetString( combo->GetStringSelection() );
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
-
- delete [] event.GetString();
}
//-----------------------------------------------------------------------------
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
- event.SetString( copystring(combo->GetValue()) );
+ event.SetString( combo->GetValue() );
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
-
- delete [] event.GetString();
}
//-----------------------------------------------------------------------------
// all!
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() );
event.SetInt( 0 );
- event.SetString( (char *)value.c_str() );
+ event.SetString( value );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
}
// and generate the selected event for it
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, GetId() );
event.SetInt( Number() - 1 );
- event.SetString( (char *)value.c_str() );
+ event.SetString( value );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
}
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
{
if (!rb->HasVMT()) return;
if (g_blockEventsOnDrag) return;
-
+
if (rb->m_alreadySent)
{
rb->m_alreadySent = FALSE;
}
rb->m_alreadySent = TRUE;
-
+
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
event.SetInt( rb->GetSelection() );
- wxString tmp( rb->GetStringSelection() );
- event.SetString( WXSTRINGCAST(tmp) );
+ event.SetString( rb->GetStringSelection() );
event.SetEventObject( rb );
rb->GetEventHandler()->ProcessEvent(event);
}
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
- int n, const wxString choices[], int majorDim,
- long style, const wxValidator& validator,
- const wxString &name )
+ int n, const wxString choices[], int majorDim,
+ long style, const wxValidator& validator,
+ const wxString &name )
{
m_alreadySent = FALSE;
m_needParent = TRUE;
m_acceptsFocus = TRUE;
-
+
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_frame_new( title );
-
+
m_majorDim = majorDim;
-
+
GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
-
+
GSList *radio_button_group = (GSList *) NULL;
for (int i = 0; i < n; i++)
{
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
-
+
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
-
+
m_boxes.Append( (wxObject*) m_radio );
-
+
ConnectWidget( GTK_WIDGET(m_radio) );
-
+
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
-
- gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
+
+ gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
-
+
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), m_x+10, m_y+10+(i*24) );
-
+
}
-
+
wxSize ls = LayoutItems();
-
+
wxSize newSize = size;
if (newSize.x == -1) newSize.x = ls.x;
if (newSize.y == -1) newSize.y = ls.y;
SetSize( newSize.x, newSize.y );
-
+
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
-
+
PostCreation();
-
+
SetLabel( title );
-
+
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
SetFont( parent->GetFont() );
Show( TRUE );
-
+
return TRUE;
}
void wxRadioBox::OnSize( wxSizeEvent &event )
{
wxControl::OnSize( event );
-
+
LayoutItems();
}
{
int x = 7;
int y = 15;
-
+
int num_per_major = (m_boxes.GetCount() - 1) / m_majorDim +1;
-
+
wxSize res( 0, 0 );
-
+
if (m_windowStyle & wxRA_HORIZONTAL)
{
-
+
for (int j = 0; j < m_majorDim; j++)
- {
+ {
y = 15;
-
+
int max_len = 0;
wxNode *node = m_boxes.Nth( j*num_per_major );
- for (int i1 = 0; i1< num_per_major; i1++)
- {
+ for (int i1 = 0; i1< num_per_major; i1++)
+ {
GtkWidget *button = GTK_WIDGET( node->Data() );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
GdkFont *font = m_widget->style->font;
int len = 22+gdk_string_measure( font, label->label );
if (len > max_len) max_len = len;
-
+
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
y += 20;
-
- node = node->Next();
- if (!node) break;
- }
-
- // we don't know the max_len before
-
+
+ node = node->Next();
+ if (!node) break;
+ }
+
+ // we don't know the max_len before
+
node = m_boxes.Nth( j*num_per_major );
- for (int i2 = 0; i2< num_per_major; i2++)
- {
+ for (int i2 = 0; i2< num_per_major; i2++)
+ {
GtkWidget *button = GTK_WIDGET( node->Data() );
-
- gtk_widget_set_usize( button, max_len, 20 );
-
- node = node->Next();
- if (!node) break;
- }
-
- if (y > res.y) res.y = y;
-
- x += max_len + 2;
+
+ gtk_widget_set_usize( button, max_len, 20 );
+
+ node = node->Next();
+ if (!node) break;
+ }
+
+ if (y > res.y) res.y = y;
+
+ x += max_len + 2;
}
-
- res.x = x+4;
- res.y += 9;
+
+ res.x = x+4;
+ res.y += 9;
}
else
{
{
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *label = GTK_LABEL( button->child );
-
+
GdkFont *font = m_widget->style->font;
int len = 22+gdk_string_measure( font, label->label );
if (len > max) max = len;
-
+
node = node->Next();
}
-
+
node = m_boxes.First();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->Data() );
-
+
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
x += max;
gtk_widget_set_usize( button, max, 20 );
-
+
node = node->Next();
}
- res.x = x+4;
- res.y = 42;
+ res.x = x+4;
+ res.y = 42;
}
-
+
return res;
}
bool wxRadioBox::Show( bool show )
{
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
-
+
wxWindow::Show( show );
wxNode *node = m_boxes.First();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->Data() );
-
+
if (show) gtk_widget_show( button ); else gtk_widget_hide( button );
-
+
node = node->Next();
}
int wxRadioBox::FindString( const wxString &s ) const
{
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
-
+
int count = 0;
-
+
wxNode *node = m_boxes.First();
while (node)
{
GtkButton *button = GTK_BUTTON( node->Data() );
-
+
GtkLabel *label = GTK_LABEL( button->child );
if (s == label->label) return count;
count++;
-
+
node = node->Next();
}
-
+
return -1;
}
void wxRadioBox::SetFocus()
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
if (m_boxes.GetCount() == 0) return;
-
+
wxNode *node = m_boxes.First();
while (node)
{
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
if (button->active)
- {
+ {
gtk_widget_grab_focus( GTK_WIDGET(button) );
-
- return;
- }
+
+ return;
+ }
node = node->Next();
}
-
+
}
void wxRadioBox::SetSelection( int n )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( n );
-
+
wxCHECK_RET( node, "radiobox wrong index" );
-
+
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() );
-
+
gtk_toggle_button_set_state( button, 1 );
}
int wxRadioBox::GetSelection(void) const
{
wxCHECK_MSG( m_widget != NULL, -1, "invalid radiobox" );
-
+
int count = 0;
-
+
wxNode *node = m_boxes.First();
while (node)
{
count++;
node = node->Next();
}
-
+
wxFAIL_MSG( "wxRadioBox none selected" );
-
+
return -1;
}
wxString wxRadioBox::GetString( int n ) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( n );
-
+
wxCHECK_MSG( node, "", "radiobox wrong index" );
-
+
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *label = GTK_LABEL( button->child );
-
+
return wxString( label->label );
}
wxString wxRadioBox::GetLabel( int item ) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
-
+
return GetString( item );
}
void wxRadioBox::SetLabel( const wxString& label )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxControl::SetLabel( label );
-
+
gtk_frame_set_label( GTK_FRAME(m_widget), wxControl::GetLabel() );
}
void wxRadioBox::SetLabel( int item, const wxString& label )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( item );
-
+
wxCHECK_RET( node, "radiobox wrong index" );
-
+
GtkButton *button = GTK_BUTTON( node->Data() );
GtkLabel *g_label = GTK_LABEL( button->child );
-
+
gtk_label_set( g_label, label );
}
void wxRadioBox::Enable( bool enable )
{
wxControl::Enable( enable );
-
+
wxNode *node = m_boxes.First();
while (node)
{
void wxRadioBox::Enable( int item, bool enable )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( item );
-
+
wxCHECK_RET( node, "radiobox wrong index" );
-
+
GtkButton *button = GTK_BUTTON( node->Data() );
GtkWidget *label = button->child;
gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
void wxRadioBox::Show( int item, bool show )
{
wxCHECK_RET( m_widget != NULL, "invalid radiobox" );
-
+
wxNode *node = m_boxes.Nth( item );
-
+
wxCHECK_RET( node, "radiobox wrong index" );
-
+
GtkWidget *button = GTK_WIDGET( node->Data() );
if (show)
wxString wxRadioBox::GetStringSelection(void) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid radiobox" );
-
+
wxNode *node = m_boxes.First();
while (node)
{
}
node = node->Next();
}
-
+
wxFAIL_MSG( "wxRadioBox none selected" );
return "";
}
bool wxRadioBox::SetStringSelection( const wxString &s )
{
- wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
-
+ wxCHECK_MSG( m_widget != NULL, FALSE, "invalid radiobox" );
+
int res = FindString( s );
if (res == -1) return FALSE;
SetSelection( res );
-
+
return TRUE;
}
void wxRadioBox::ApplyWidgetStyle()
{
SetWidgetStyle();
-
+
gtk_widget_set_style( m_widget, m_widgetStyle );
-
+
wxNode *node = m_boxes.First();
while (node)
{
GtkWidget *widget = GTK_WIDGET( node->Data() );
gtk_widget_set_style( widget, m_widgetStyle );
-
+
GtkButton *button = GTK_BUTTON( node->Data() );
gtk_widget_set_style( button->child, m_widgetStyle );
-
+
node = node->Next();
}
}
bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{
if (window == m_widget->window) return TRUE;
-
+
wxNode *node = m_boxes.First();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->Data() );
-
+
if (window == button->window) return TRUE;
-
+
node = node->Next();
}
-
+
return FALSE;
}
///////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
-#pragma implementation "listbox.h"
+ #pragma implementation "listbox.h"
#endif
#include "wx/listbox.h"
#include "wx/motif/private.h"
#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
+ IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
#endif
-void wxListBoxCallback (Widget w, XtPointer clientData,
- XmListCallbackStruct * cbs);
+static void wxListBoxCallback(Widget w,
+ XtPointer clientData,
+ XmListCallbackStruct * cbs);
-void wxListBoxDefaultActionProc (Widget list_w, XtPointer client_data, XmListCallbackStruct * cbs);
+static void wxListBoxDefaultActionProc(Widget list_w,
+ XtPointer client_data,
+ XmListCallbackStruct * cbs);
// ============================================================================
// list box control implementation
// ============================================================================
// Listbox item
-wxListBox::wxListBox(): m_clientDataList(wxKEY_INTEGER)
+wxListBox::wxListBox() : m_clientDataList(wxKEY_INTEGER)
{
m_noItems = 0;
m_selected = 0;
// m_backgroundColour = parent->GetBackgroundColour();
m_backgroundColour = * wxWHITE;
m_foregroundColour = parent->GetForegroundColour();
-
+
SetName(name);
SetValidator(validator);
-
+
if (parent) parent->AddChild(this);
-
+
m_windowId = ( id == -1 ) ? (int)NewControlId() : id;
-
+
Widget parentWidget = (Widget) parent->GetClientWidget();
-
+
Arg args[3];
int count;
XtSetArg (args[0], XmNlistSizePolicy, XmCONSTANT);
}
else
count = 2;
-
+
Widget listWidget = XmCreateScrolledList (parentWidget, (char*) (const char*) name, args, count);
-
+
m_mainWidget = (WXWidget) listWidget;
-
+
Set(n, choices);
-
+
XtManageChild (listWidget);
-
+
long width = size.x;
long height = size.y;
if (width == -1)
width = 150;
if (height == -1)
height = 80;
-
+
XtAddCallback (listWidget, XmNbrowseSelectionCallback, (XtCallbackProc) wxListBoxCallback,
(XtPointer) this);
XtAddCallback (listWidget, XmNextendedSelectionCallback, (XtCallbackProc) wxListBoxCallback,
(XtPointer) this);
XtAddCallback (listWidget, XmNmultipleSelectionCallback, (XtCallbackProc) wxListBoxCallback,
(XtPointer) this);
-
+
XtAddCallback (listWidget, XmNdefaultActionCallback, (XtCallbackProc) wxListBoxDefaultActionProc,
(XtPointer) this);
-
+
m_windowFont = parent->GetFont();
ChangeFont(FALSE);
-
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, width, height);
-
+
ChangeBackgroundColour();
-
+
return TRUE;
}
void wxListBox::SetFirstItem(int N)
{
int count, length;
-
+
if (N < 0)
return;
XtVaGetValues ((Widget) m_mainWidget,
- XmNvisibleItemCount, &count,
- XmNitemCount, &length,
- NULL);
+ XmNvisibleItemCount, &count,
+ XmNitemCount, &length,
+ NULL);
if ((N + count) >= length)
N = length - count;
XmListSetPos ((Widget) m_mainWidget, N + 1);
void wxListBox::SetFirstItem(const wxString& s)
{
int N = FindString (s);
-
+
if (N >= 0)
SetFirstItem (N);
}
int width2, height2;
Widget listBox = (Widget) m_mainWidget;
GetSize (&width1, &height1);
-
+
bool managed = XtIsManaged(listBox);
-
+
if (managed)
XtUnmanageChild (listBox);
-
+
XmListDeletePos (listBox, N + 1);
-
+
if (managed)
XtManageChild (listBox);
-
+
GetSize (&width2, &height2);
// Correct for randomly resized listbox - bad boy, Motif!
if (width1 != width2 || height1 != height2)
SetSize (-1, -1, width1, height1);
-
+
// (JDH) need to add code here to take care of clientDataList
wxNode *node = m_clientDataList.Find((long)N); // get item from list
if (node) m_clientDataList.DeleteNode(node); // if existed then delete from list
node = m_clientDataList.First(); // we now have to adjust all keys that
while (node) // are >=N+1
- { if (node->GetKeyInteger() >= (long)(N+1))
- node->SetKeyInteger(node->GetKeyInteger() - 1);
- node = node->Next();
+ {
+ if (node->GetKeyInteger() >= (long)(N+1))
+ node->SetKeyInteger(node->GetKeyInteger() - 1);
+ node = node->Next();
}
-
+
m_noItems --;
}
{
int width1, height1;
int width2, height2;
-
+
Widget listBox = (Widget) m_mainWidget;
GetSize (&width1, &height1);
-
+
bool managed = XtIsManaged(listBox);
-
+
if (managed)
XtUnmanageChild (listBox);
int n;
// XmListAddItem(listBox, text, n + 1);
XmListAddItemUnselected (listBox, text, 0);
XmStringFree (text);
-
+
// It seems that if the list is cleared, we must re-ask for
// selection policy!!
Arg args[3];
else
XtSetArg (args[1], XmNselectionPolicy, XmBROWSE_SELECT);
XtSetValues (listBox, args, 2);
-
+
if (managed)
XtManageChild (listBox);
-
+
GetSize (&width2, &height2);
// Correct for randomly resized listbox - bad boy, Motif!
if (width1 != width2 || height1 != height2)
{
int width1, height1;
int width2, height2;
-
+
Widget listBox = (Widget) m_mainWidget;
-
+
GetSize (&width1, &height1);
Bool managed = XtIsManaged(listBox);
-
+
if (managed)
XtUnmanageChild (listBox);
-
+
int n;
XtVaGetValues (listBox, XmNitemCount, &n, NULL);
XmString text = XmStringCreateSimple ((char*) (const char*) item);
// XmListAddItem(listBox, text, n + 1);
XmListAddItemUnselected (listBox, text, 0);
XmStringFree (text);
-
+
// It seems that if the list is cleared, we must re-ask for
// selection policy!!
Arg args[3];
else
XtSetArg (args[1], XmNselectionPolicy, XmBROWSE_SELECT);
XtSetValues (listBox, args, 2);
-
+
m_clientDataList.Append ((long) n, (wxObject *) clientData);
-
+
if (managed)
XtManageChild (listBox);
-
+
GetSize (&width2, &height2);
-
+
// Correct for randomly resized listbox - bad boy, Motif!
if (width1 != width2 || height1 != height2)
SetSize (-1, -1, width1, height1);
-
+
m_noItems ++;
}
m_clientDataList.Clear();
int width1, height1;
int width2, height2;
-
+
Widget listBox = (Widget) m_mainWidget;
GetSize (&width1, &height1);
-
+
bool managed = XtIsManaged(listBox);
-
+
if (managed)
XtUnmanageChild (listBox);
/***
int i;
for (i = 0; i < n; i++)
text[i] = XmStringCreateSimple ((char*) (const char*) choices[i]);
-
+
if ( clientData )
for (i = 0; i < n; i++)
m_clientDataList.Append ((long) i, (wxObject *) clientData[i]);
-
+
XmListAddItems (listBox, text, n, 0);
for (i = 0; i < n; i++)
XmStringFree (text[i]);
delete[]text;
-
+
// It seems that if the list is cleared, we must re-ask for
// selection policy!!
Arg args[3];
else
XtSetArg (args[1], XmNselectionPolicy, XmBROWSE_SELECT);
XtSetValues (listBox, args, 2);
-
+
if (managed)
XtManageChild (listBox);
-
+
GetSize (&width2, &height2);
// Correct for randomly resized listbox - bad boy, Motif!
if (width1 != width2 || height1 != height2)
SetSize (-1, -1, width1, height1);
-
+
m_noItems = n;
}
{
if (m_noItems <= 0)
return;
-
+
int width1, height1;
int width2, height2;
-
+
Widget listBox = (Widget) m_mainWidget;
GetSize (&width1, &height1);
-
+
XmListDeleteAllItems (listBox);
m_clientDataList.Clear ();
GetSize (&width2, &height2);
-
+
// Correct for randomly resized listbox - bad boy, Motif!
if (width1 != width2 || height1 != height2)
SetSize (-1, -1, width1, height1);
-
+
m_noItems = 0;
}
m_inSetValue = TRUE;
if (select)
{
- /*
- if (m_windowStyle & wxLB_MULTIPLE)
- {
- int *selections = NULL;
- int n = GetSelections (&selections);
-
- // This hack is supposed to work, to make it possible to select more
- // than one item, but it DOESN'T under Motif 1.1.
-
- XtVaSetValues ((Widget) m_mainWidget, XmNselectionPolicy, XmMULTIPLE_SELECT, NULL);
-
- int i;
- for (i = 0; i < n; i++)
- XmListSelectPos ((Widget) m_mainWidget, selections[i] + 1, FALSE);
-
+#if 0
+ if (m_windowStyle & wxLB_MULTIPLE)
+ {
+ int *selections = NULL;
+ int n = GetSelections (&selections);
+
+ // This hack is supposed to work, to make it possible to select more
+ // than one item, but it DOESN'T under Motif 1.1.
+
+ XtVaSetValues ((Widget) m_mainWidget, XmNselectionPolicy, XmMULTIPLE_SELECT, NULL);
+
+ int i;
+ for (i = 0; i < n; i++)
+ XmListSelectPos ((Widget) m_mainWidget, selections[i] + 1, FALSE);
+
+ XmListSelectPos ((Widget) m_mainWidget, N + 1, FALSE);
+
+ XtVaSetValues ((Widget) m_mainWidget, XmNselectionPolicy, XmEXTENDED_SELECT, NULL);
+ }
+ else
+#endif // 0
XmListSelectPos ((Widget) m_mainWidget, N + 1, FALSE);
-
- XtVaSetValues ((Widget) m_mainWidget, XmNselectionPolicy, XmEXTENDED_SELECT, NULL);
- }
- else
- */
- XmListSelectPos ((Widget) m_mainWidget, N + 1, FALSE);
-
+
}
else
XmListDeselectPos ((Widget) m_mainWidget, N + 1);
-
+
m_inSetValue = FALSE;
}
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
aSelections.Empty();
-
+
Widget listBox = (Widget) m_mainWidget;
int *posList = NULL;
int posCnt = 0;
if (posCnt > 0)
{
aSelections.Alloc(posCnt);
-
+
int i;
for (i = 0; i < posCnt; i++)
aSelections.Add(posList[i] - 1);
-
+
XtFree ((char *) posList);
return posCnt;
}
void wxListBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
wxWindow::DoSetSize(x, y, width, height, sizeFlags);
-
+
// Check resulting size is correct
int tempW, tempH;
GetSize (&tempW, &tempH);
-
+
/*
if (tempW != width || tempH != height)
{
{
int width1, height1;
int width2, height2;
-
+
Widget listBox = (Widget) m_mainWidget;
-
+
GetSize(&width1, &height1);
-
+
bool managed = XtIsManaged(listBox);
-
+
if (managed)
XtUnmanageChild(listBox);
-
+
XmString *text = new XmString[nItems];
int i;
// Steve Hammes: Motif 1.1 compatibility
#endif
for (i = 0; i < nItems; i++)
XmStringFree(text[i]);
-
+
delete[] text;
-
+
// It seems that if the list is cleared, we must re-ask for
// selection policy!!
Arg args[3];
XtSetArg(args[1], XmNselectionPolicy, XmEXTENDED_SELECT);
else XtSetArg(args[1], XmNselectionPolicy, XmBROWSE_SELECT);
XtSetValues(listBox,args,2) ;
-
+
if (managed)
XtManageChild(listBox);
-
+
GetSize(&width2, &height2);
// Correct for randomly resized listbox - bad boy, Motif!
if (width1 != width2 /*|| height1 != height2*/)
SetSize(-1, -1, width1, height1);
-
+
m_noItems += nItems;
}
{
int width1, height1;
int width2, height2;
-
+
Widget listBox = (Widget) m_mainWidget;
GetSize (&width1, &height1);
-
+
XmString text = XmStringCreateSimple ((char*) (const char*) s);
-
- // WHAT'S THE MOTIF CALL TO SET THE TEXT OF AN EXISTING
- // ITEM???
- // There isn't one, so delete the item and add it again.
+
+ // delete the item and add it again.
+ // FIXME isn't there a way to change it in place?
XmListDeletePos (listBox, N+1);
XmListAddItem (listBox, text, N+1);
-
+
XmStringFree(text);
-
- /*
- // It seems that if the list is cleared, we must re-ask for
- // selection policy!!
- Arg args[3];
- XtSetArg (args[0], XmNlistSizePolicy, XmCONSTANT);
- if (m_windowStyle & wxLB_MULTIPLE)
- XtSetArg (args[1], XmNselectionPolicy, XmMULTIPLE_SELECT);
- else if (m_windowStyle & wxLB_EXTENDED)
- XtSetArg (args[1], XmNselectionPolicy, XmEXTENDED_SELECT);
- else
- XtSetArg (args[1], XmNselectionPolicy, XmBROWSE_SELECT);
- XtSetValues (listBox, args, 2);
- */
-
+
GetSize (&width2, &height2);
// Correct for randomly resized listbox - bad boy, Motif!
if (width1 != width2 || height1 != height2)
// For single selection items only
wxString wxListBox::GetStringSelection () const
{
- int sel = GetSelection ();
+ wxString res;
+ int sel = GetSelection();
if (sel > -1)
- return this->GetString (sel);
- else
- return wxString("");
+ res = GetString(sel);
+
+ return res;
}
bool wxListBox::SetStringSelection (const wxString& s, bool flag)
void wxListBoxCallback (Widget w, XtPointer clientData,
XmListCallbackStruct * cbs)
{
-/*
+ /*
if (cbs->reason == XmCR_EXTENDED_SELECT)
cout << "*** Extend select\n";
else if (cbs->reason == XmCR_SINGLE_SELECT)
else if (cbs->selection_type == XmADDITION)
cout << "*** Addition\n";
*/
-
+
wxListBox *item = (wxListBox *) clientData;
-
+
if (item->InSetValue())
return;
-
+
wxCommandEvent event (wxEVT_COMMAND_LISTBOX_SELECTED, item->GetId());
switch (cbs->reason)
{
case XmCR_BROWSE_SELECT:
{
event.m_clientData = item->GetClientData (cbs->item_position - 1);
- //event.commandString = item->GetStringSelection();
event.m_commandInt = cbs->item_position - 1;
event.m_extraLong = TRUE;
event.SetEventObject(item);
item->ProcessCommand (event);
- //delete[] event.commandString; // Let's not store the command string any more
break;
}
case XmCR_EXTENDED_SELECT:
void wxListBoxDefaultActionProc (Widget list_w, XtPointer client_data, XmListCallbackStruct * cbs)
{
wxListBox *lbox = (wxListBox *) client_data;
-
+
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, lbox->GetId());
event.SetEventObject( lbox );
lbox->GetEventHandler()->ProcessEvent(event) ;
void wxListBox::ChangeBackgroundColour()
{
wxWindow::ChangeBackgroundColour();
-
+
Widget parent = XtParent ((Widget) m_mainWidget);
Widget hsb, vsb;
-
+
XtVaGetValues (parent,
XmNhorizontalScrollBar, &hsb,
XmNverticalScrollBar, &vsb,
NULL);
-
+
/* TODO: should scrollbars be affected? Should probably have separate
* function to change them (by default, taken from wxSystemSettings)
*/
XtVaSetValues (vsb,
XmNtroughColor, backgroundColour.AllocColour(XtDisplay(vsb)),
NULL);
-
+
DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
}
void wxListBox::ChangeForegroundColour()
{
wxWindow::ChangeForegroundColour();
-
+
Widget parent = XtParent ((Widget) m_mainWidget);
Widget hsb, vsb;
-
- XtVaGetValues (parent,
- XmNhorizontalScrollBar, &hsb,
- XmNverticalScrollBar, &vsb,
- NULL);
- /* TODO: should scrollbars be affected? Should probably have separate
- * function to change them (by default, taken from wxSystemSettings)
+
+ XtVaGetValues(parent,
+ XmNhorizontalScrollBar, &hsb,
+ XmNverticalScrollBar, &vsb,
+ NULL);
+
+ /* TODO: should scrollbars be affected? Should probably have separate
+ function to change them (by default, taken from wxSystemSettings)
+
DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
DoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
event.SetInt(GetSelection());
event.SetEventObject(this);
- event.SetString(copystring(GetStringSelection()));
+ event.SetString(GetStringSelection());
ProcessCommand(event);
- delete[] event.GetString();
+
return TRUE;
}
- else return FALSE;
+ else
+ return FALSE;
}
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId);
event.SetInt(GetSelection());
event.SetEventObject(this);
- event.SetString(copystring(GetStringSelection()));
+ event.SetString(GetStringSelection());
ProcessCommand(event);
- delete[] event.GetString();
+
return TRUE;
}
else if (param == CBN_EDITCHANGE)
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
- event.SetString(copystring(GetValue()));
+ event.SetString(GetValue());
event.SetEventObject(this);
ProcessCommand(event);
- delete[] event.GetString();
+
return TRUE;
}
- else return FALSE;
+ else
+ return FALSE;
}
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,