splitter.cpp G
statusbr.cpp G
tabg.cpp G
+numdlgg.cpp G
textdlgg.cpp G
tipdlg.cpp G
treectrl.cpp G 16
virtual void OnCommand(wxWindow& WXUNUSED(win),
wxCommandEvent& WXUNUSED(event))
{
+ wxFAIL_MSG("shouldn't be called any more");
}
- // Called if child control has no
- // callback function
- // Default behaviour
+ // Called if child control has no callback function
virtual long Default()
{ return GetNextHandler() ? GetNextHandler()->Default() : 0; };
#endif // WXWIN_COMPATIBILITY_2
};
// ----------------------------------------------------------------------------
-// functions to get a string or a number from user
+// function to get a string from user
// ----------------------------------------------------------------------------
wxString WXDLLEXPORT
int y = -1,
bool centre = TRUE);
-long WXDLLEXPORT
-wxGetNumberFromUser(const wxString& message,
- const wxString& prompt,
- const wxString& caption,
- long value = 0,
- long min = 0,
- long max = 100,
- wxWindow *parent = (wxWindow *)NULL,
- const wxPoint& pos = wxDefaultPosition);
-
#endif
// __TEXTDLGH_G__
GSOCK_INPUT_FLAG = 1 << GSOCK_INPUT,
GSOCK_OUTPUT_FLAG = 1 << GSOCK_OUTPUT,
GSOCK_CONNECTION_FLAG = 1 << GSOCK_CONNECTION,
- GSOCK_LOST_FLAG = 1 << GSOCK_LOST,
+ GSOCK_LOST_FLAG = 1 << GSOCK_LOST
};
typedef int GSocketEventFlags;
typedef void (*GSocketFallback)(GSocket *socket, GSocketEvent event,
- char *cdata);
+ char *cdata);
#ifdef __cplusplus
extern "C" {
/* Generic IO */
/* Like recv(), send(), ... */
-/*
+/*
NOTE: In case we read from a non-oriented connection, the incoming (outgoing)
- connection address is stored in the "Local" ("Peer") field.
+ connection address is stored in the "Local" ("Peer") field.
*/
int GSocket_Read(GSocket *socket, char *buffer, int size);
int GSocket_Write(GSocket *socket, const char *buffer,
- int size);
+ int size);
bool GSocket_DataAvailable(GSocket *socket);
/* Flags */
/* Callbacks */
-/*
+/*
Only one fallback is possible for each event (INPUT, OUTPUT, CONNECTION, LOST)
- INPUT: The function is called when there is at least a byte in the
+ INPUT: The function is called when there is at least a byte in the
input buffer
OUTPUT: The function is called when the system is sure the next write call
will not block
CONNECTION: Two cases is possible:
Client socket -> the connection is established
- Server socket -> a client request a connection
+ Server socket -> a client request a connection
LOST: the connection is lost
SetFallback accepts a combination of these flags so a same callback can
CONNECTION -> GSocket_Accept()
*/
void GSocket_SetFallback(GSocket *socket, GSocketEventFlags event,
- GSocketFallback fallback, char *cdata);
+ GSocketFallback fallback, char *cdata);
/*
UnsetFallback will disables all fallbacks specified by "event".
void GAddress_SetFamily(GAddress *address, GAddressType type);
GAddressType GAddress_GetFamily(GAddress *address);
-/*
+/*
The use of any of the next functions will set the address family to the adapted
one. For example if you use GAddress_INET_SetHostName, address family will be AF_INET
implicitely
// Modified by:
// RCS-ID: $Id$
// Copyright: (c) Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKSPINPUTTH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#ifdef wxUSE_SPINBTN
-
-#include "wx/object.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxSpinButton;
-class wxSpinEvent;
-
//-----------------------------------------------------------------------------
// wxSpinButton
//-----------------------------------------------------------------------------
-class wxSpinButton : public wxControl
+class wxSpinButton : public wxSpinButtonBase
{
- DECLARE_DYNAMIC_CLASS(wxSpinButton)
-
-public:
- wxSpinButton();
- inline wxSpinButton( wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
- {
- Create(parent, id, pos, size, style, name);
- }
- ~wxSpinButton();
- bool Create( wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton" );
-
- int GetValue() const;
- void SetValue( int value );
- void SetRange( int minVal, int maxVal );
- int GetMin() const;
- int GetMax() const;
-
-// implementation
-
- void OnSize( wxSizeEvent &event );
-
- bool IsOwnGtkWindow( GdkWindow *window );
- void ApplyWidgetStyle();
-
- GtkAdjustment *m_adjust;
- float m_oldPos;
-
- DECLARE_EVENT_TABLE()
-};
-
-//-----------------------------------------------------------------------------
-// wxSpinEvent
-//-----------------------------------------------------------------------------
-
-class wxSpinEvent : public wxScrollEvent
-{
- DECLARE_DYNAMIC_CLASS(wxSpinEvent)
+ DECLARE_DYNAMIC_CLASS(wxSpinButton)
public:
- wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
+ wxSpinButton() { }
+ wxSpinButton( wxWindow *parent, wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
+ {
+ Create(parent, id, pos, size, style, name);
+ }
+ ~wxSpinButton();
+
+ bool Create( wxWindow *parent, wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton" );
+
+ virtual int GetValue() const;
+ virtual void SetValue( int value );
+ virtual void SetRange( int minVal, int maxVal );
+ virtual int GetMin() const;
+ virtual int GetMax() const;
+
+ // implementation
+ void OnSize( wxSizeEvent &event );
+
+ bool IsOwnGtkWindow( GdkWindow *window );
+ void ApplyWidgetStyle();
+
+ GtkAdjustment *m_adjust;
+ float m_oldPos;
+
+private:
+ DECLARE_EVENT_TABLE()
};
-typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
-
-// Spin events
-
-#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-
-#define EVT_SPIN(id, func) \
- { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
-
-#endif
-
#endif
// __GTKSPINBUTTH__
// Modified by:
// RCS-ID: $Id$
// Copyright: (c) Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKSPINPUTTH__
#pragma interface
#endif
-#include "wx/defs.h"
-
-#ifdef wxUSE_SPINBTN
-
-#include "wx/object.h"
-#include "wx/control.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class wxSpinButton;
-class wxSpinEvent;
-
//-----------------------------------------------------------------------------
// wxSpinButton
//-----------------------------------------------------------------------------
-class wxSpinButton : public wxControl
+class wxSpinButton : public wxSpinButtonBase
{
- DECLARE_DYNAMIC_CLASS(wxSpinButton)
-
-public:
- wxSpinButton();
- inline wxSpinButton( wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
- {
- Create(parent, id, pos, size, style, name);
- }
- ~wxSpinButton();
- bool Create( wxWindow *parent, wxWindowID id = -1,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton" );
-
- int GetValue() const;
- void SetValue( int value );
- void SetRange( int minVal, int maxVal );
- int GetMin() const;
- int GetMax() const;
-
-// implementation
-
- void OnSize( wxSizeEvent &event );
-
- bool IsOwnGtkWindow( GdkWindow *window );
- void ApplyWidgetStyle();
-
- GtkAdjustment *m_adjust;
- float m_oldPos;
-
- DECLARE_EVENT_TABLE()
-};
-
-//-----------------------------------------------------------------------------
-// wxSpinEvent
-//-----------------------------------------------------------------------------
-
-class wxSpinEvent : public wxScrollEvent
-{
- DECLARE_DYNAMIC_CLASS(wxSpinEvent)
+ DECLARE_DYNAMIC_CLASS(wxSpinButton)
public:
- wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
+ wxSpinButton() { }
+ wxSpinButton( wxWindow *parent, wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
+ {
+ Create(parent, id, pos, size, style, name);
+ }
+ ~wxSpinButton();
+
+ bool Create( wxWindow *parent, wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton" );
+
+ virtual int GetValue() const;
+ virtual void SetValue( int value );
+ virtual void SetRange( int minVal, int maxVal );
+ virtual int GetMin() const;
+ virtual int GetMax() const;
+
+ // implementation
+ void OnSize( wxSizeEvent &event );
+
+ bool IsOwnGtkWindow( GdkWindow *window );
+ void ApplyWidgetStyle();
+
+ GtkAdjustment *m_adjust;
+ float m_oldPos;
+
+private:
+ DECLARE_EVENT_TABLE()
};
-typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
-
-// Spin events
-
-#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-
-#define EVT_SPIN(id, func) \
- { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
-
-#endif
-
#endif
// __GTKSPINBUTTH__
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BUTTON_H_
#define _WX_BUTTON_H_
#ifdef __GNUG__
-#pragma interface "button.h"
+ #pragma interface "button.h"
#endif
#include "wx/control.h"
// Pushbutton
class WXDLLEXPORT wxButton: public wxControl
{
- DECLARE_DYNAMIC_CLASS(wxButton)
- public:
- inline wxButton() {}
- inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr)
- {
- Create(parent, id, label, pos, size, style, validator, name);
- }
-
- bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr);
-
- virtual void SetDefault();
- virtual void Command(wxCommandEvent& event);
-
-// Implementation
- virtual void ChangeFont(bool keepOriginalSize = TRUE);
- virtual void ChangeBackgroundColour();
- virtual void ChangeForegroundColour();
+ DECLARE_DYNAMIC_CLASS(wxButton)
+
+public:
+ wxButton() { }
+ wxButton(wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr)
+ {
+ Create(parent, id, label, pos, size, style, validator, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize, long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr);
+
+ virtual void SetDefault();
+ virtual void Command(wxCommandEvent& event);
+
+ // Implementation
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
+ virtual void ChangeBackgroundColour();
+ virtual void ChangeForegroundColour();
};
#endif
wxControl();
~wxControl();
- virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
- virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
- // appropriate event handlers
+ // simulates the event, returns TRUE if the event was processed
+ virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
+
+ // calls the callback and appropriate event handlers, returns TRUE if
+ // event was processed
+ virtual bool ProcessCommand(wxCommandEvent& event);
+
virtual void SetLabel(const wxString& label);
virtual wxString GetLabel() const ;
- // Places item in centre of panel - so can't be used BEFORE panel->Fit()
- void Centre(int direction = wxHORIZONTAL);
+#if WXWIN_COMPATIBILITY
void Callback(const wxFunction function) { m_callback = function; }; // Adds callback
wxFunction GetCallback() { return m_callback; }
+#endif // WXWIN_COMPATIBILITY
bool InSetValue() const { return m_inSetValue; }
protected:
+#if WXWIN_COMPATIBILITY
wxFunction m_callback; // Callback associated with the window
+#endif // WXWIN_COMPATIBILITY
bool m_inSetValue; // Motif: prevent callbacks being called while
// in SetValue
extern wxWindow *wxGetWindowFromTable(Widget w);
extern bool wxAddWindowToTable(Widget w, wxWindow *win);
+// ----------------------------------------------------------------------------
+// key events related functions
+// ----------------------------------------------------------------------------
+
extern char wxFindMnemonic(const char* s);
-extern char * wxFindAccelerator (char *s);
-extern XmString wxFindAcceleratorText (char *s);
+
+extern char * wxFindAccelerator (const char *s);
+extern XmString wxFindAcceleratorText (const char *s);
+
extern int wxCharCodeXToWX(KeySym keySym);
extern KeySym wxCharCodeWXToX(int id);
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SPINBUTT_H_
#define _WX_SPINBUTT_H_
#ifdef __GNUG__
-#pragma interface "spinbutt.h"
+ #pragma interface "spinbutt.h"
#endif
-#include "wx/control.h"
-#include "wx/event.h"
-
-/*
- The wxSpinButton is like a small scrollbar than is often placed next
- to a text control.
-
- wxSP_HORIZONTAL: horizontal spin button
- wxSP_VERTICAL: vertical spin button (the default)
- wxSP_ARROW_KEYS: arrow keys increment/decrement value
- wxSP_WRAP: value wraps at either end
- */
-
-class WXDLLEXPORT wxSpinButton: public wxControl
+class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase
{
- DECLARE_DYNAMIC_CLASS(wxSpinButton)
- public:
- /*
- * Public interface
- */
-
- wxSpinButton();
-
- inline wxSpinButton(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
- {
- Create(parent, id, pos, size, style, name);
- }
- ~wxSpinButton();
-
- bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton");
-
-
- // Attributes
- ////////////////////////////////////////////////////////////////////////////
-
- int GetValue() const ;
- void SetValue(int val) ;
- void SetRange(int minVal, int maxVal) ;
- inline int GetMin() const { return m_min; }
- inline int GetMax() const { return m_max; }
-
- // Operations
- ////////////////////////////////////////////////////////////////////////////
-
- void Command(wxCommandEvent& event) { ProcessCommand(event); };
-
-// Implementation
- virtual void ChangeFont(bool keepOriginalSize = TRUE);
- virtual void ChangeBackgroundColour();
- virtual void ChangeForegroundColour();
+ DECLARE_DYNAMIC_CLASS(wxSpinButton)
+
+public:
+ wxSpinButton() { }
+
+ wxSpinButton(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL,
+ const wxString& name = "wxSpinButton")
+ {
+ Create(parent, id, pos, size, style, name);
+ }
+ ~wxSpinButton();
+
+ bool Create(wxWindow *parent,
+ wxWindowID id = -1,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxSP_VERTICAL,
+ const wxString& name = "wxSpinButton");
+
+
+ // accessors
+ int GetValue() const;
+ int GetMin() const { return m_min; }
+ int GetMax() const { return m_max; }
+
+ // operations
+ void SetValue(int val);
+ void SetRange(int minVal, int maxVal);
+
+ // Implementation
+ virtual void Command(wxCommandEvent& event) { (void)ProcessCommand(event); };
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
+ virtual void ChangeBackgroundColour();
+ virtual void ChangeForegroundColour();
protected:
- int m_min;
- int m_max;
-};
-
-class WXDLLEXPORT wxSpinEvent: public wxScrollEvent
-{
- DECLARE_DYNAMIC_CLASS(wxSpinEvent)
-
- public:
- wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
+ int m_min;
+ int m_max;
};
-typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
-
-// Spin events
-
-#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-
-#define EVT_SPIN(id, func) \
- { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
-
#endif
// _WX_SPINBUTT_H_
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATBMP_H_
virtual void SetBitmap(const wxBitmap& bitmap);
- virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
- virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
+ virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event))
+ {
+ return FALSE;
+ }
wxBitmap& GetBitmap() const { return (wxBitmap&) m_messageBitmap; }
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATBOX_H_
long style = 0,
const wxString& name = wxStaticBoxNameStr);
- virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
- virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
+ virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event))
+ {
+ return FALSE;
+ }
void SetLabel(const wxString& label);
wxString GetLabel() const;
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_STATTEXT_H_
class WXDLLEXPORT wxStaticText: public wxControl
{
- DECLARE_DYNAMIC_CLASS(wxStaticText)
- public:
- inline wxStaticText() { }
-
- inline wxStaticText(wxWindow *parent, wxWindowID id,
- const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = wxStaticTextNameStr)
- {
- Create(parent, id, label, pos, size, style, name);
- }
-
- bool Create(wxWindow *parent, wxWindowID id,
- const wxString& label,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = wxStaticTextNameStr);
-
- // operations
- virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
- virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
-
-// Implementation
- virtual void ChangeFont(bool keepOriginalSize = TRUE);
- virtual void ChangeBackgroundColour();
- virtual void ChangeForegroundColour();
+ DECLARE_DYNAMIC_CLASS(wxStaticText)
+
+public:
+ wxStaticText() { }
+
+ wxStaticText(wxWindow *parent, wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticTextNameStr)
+ {
+ Create(parent, id, label, pos, size, style, name);
+ }
+
+ bool Create(wxWindow *parent, wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxStaticTextNameStr);
+
+ // implementation
+ // --------------
+
+ // operations
+ virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event))
+ {
+ return FALSE;
+ }
+
+ virtual void ChangeFont(bool keepOriginalSize = TRUE);
+ virtual void ChangeBackgroundColour();
+ virtual void ChangeForegroundColour();
};
#endif
#pragma interface "textctrl.h"
#endif
-#include "wx/control.h"
-#include "wx/ioswrap.h"
-
-// TODO Some platforms/compilers don't like inheritance from streambuf.
-#if (defined(__BORLANDC__) && !defined(__WIN32__)) || defined(__MWERKS__)
- #define NO_TEXT_WINDOW_STREAM
-#endif
-
WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr;
WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
// Single-line text item
-class WXDLLEXPORT wxTextCtrl: public wxControl
-#ifndef NO_TEXT_WINDOW_STREAM
- , public streambuf
-#endif
+class WXDLLEXPORT wxTextCtrl : public wxControl
{
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr)
-#ifndef NO_TEXT_WINDOW_STREAM
- : streambuf()
-#endif
{
Create(parent, id, value, pos, size, style, validator, name);
}
virtual void GetSelection(long* from, long* to) const;
virtual bool IsEditable() const ;
- // streambuf implementation
-#ifndef NO_TEXT_WINDOW_STREAM
- int overflow(int i);
- int sync();
- int underflow();
-#endif
-
- wxTextCtrl& operator<<(const wxString& s);
- wxTextCtrl& operator<<(int i);
- wxTextCtrl& operator<<(long i);
- wxTextCtrl& operator<<(float f);
- wxTextCtrl& operator<<(double d);
- wxTextCtrl& operator<<(const char c);
-
virtual bool LoadFile(const wxString& file);
virtual bool SaveFile(const wxString& file);
virtual void WriteText(const wxString& text);
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SPINBUTT_H_
#if defined(__WIN95__)
-/*
- The wxSpinButton is like a small scrollbar than is often placed next
- to a text control.
- wxSP_HORIZONTAL: horizontal spin button
- wxSP_VERTICAL: vertical spin button (the default)
- wxSP_ARROW_KEYS: arrow keys increment/decrement value
- wxSP_WRAP: value wraps at either end
- */
-
-class WXDLLEXPORT wxSpinButton : public wxControl
+class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase
{
DECLARE_DYNAMIC_CLASS(wxSpinButton)
// Attributes
////////////////////////////////////////////////////////////////////////////
- int GetValue() const ;
- void SetValue(int val) ;
- void SetRange(int minVal, int maxVal);
- int GetMin() const { return m_min; }
- int GetMax() const { return m_max; }
-
- // Operations
- ////////////////////////////////////////////////////////////////////////////
+ virtual int GetValue() const;
+ virtual void SetValue(int val);
+ virtual void SetRange(int minVal, int maxVal);
// IMPLEMENTATION
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
WXWORD pos, WXHWND control);
-
-protected:
- int m_min;
- int m_max;
};
-class WXDLLEXPORT wxSpinEvent: public wxScrollEvent
-{
- DECLARE_DYNAMIC_CLASS(wxSpinEvent)
-
-public:
- wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
-};
-
-typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
-
-// Spin events
-
-#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
-
-#define EVT_SPIN(id, func) \
- { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
- { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
-
#endif
// _WX_WIN95__
#endif
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/spinbutt.h
+// Purpose: wxSpinButtonBase class
+// Author: Julian Smart, Vadim Zeitlin
+// Modified by:
+// Created: 23.07.99
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
#ifndef _WX_SPINBUTT_H_BASE_
#define _WX_SPINBUTT_H_BASE_
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "wx/defs.h"
+
+#ifdef wxUSE_SPINBTN
+
+#include "wx/control.h"
+#include "wx/event.h"
+
+// ----------------------------------------------------------------------------
+// The wxSpinButton is like a small scrollbar than is often placed next
+// to a text control.
+//
+// Styles:
+// wxSP_HORIZONTAL: horizontal spin button
+// wxSP_VERTICAL: vertical spin button (the default)
+// wxSP_ARROW_KEYS: arrow keys increment/decrement value
+// wxSP_WRAP: value wraps at either end
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxSpinButtonBase : public wxControl
+{
+public:
+ wxSpinButtonBase() { InitBase(); }
+
+ // accessors
+ virtual int GetValue() const = 0;
+ virtual int GetMin() const { return m_min; }
+ virtual int GetMax() const { return m_max; }
+
+ // operations
+ virtual void SetValue(int val) = 0;
+ virtual void SetRange(int minVal, int maxVal)
+ {
+ m_min = minVal;
+ m_max = maxVal;
+ }
+
+protected:
+ // init the base part of the control
+ void InitBase()
+ {
+ m_min = 0;
+ m_max = 100;
+ }
+
+ // the range value
+ int m_min;
+ int m_max;
+};
+
+// ----------------------------------------------------------------------------
+// include the declaration of the real class
+// ----------------------------------------------------------------------------
+
#if defined(__WXMSW__)
-#include "wx/msw/spinbutt.h"
+ #include "wx/msw/spinbutt.h"
#elif defined(__WXMOTIF__)
-#include "wx/motif/spinbutt.h"
+ #include "wx/motif/spinbutt.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/spinbutt.h"
+ #include "wx/gtk/spinbutt.h"
#elif defined(__WXQT__)
-#include "wx/qt/spinbutt.h"
+ #include "wx/qt/spinbutt.h"
#elif defined(__WXMAC__)
-#include "wx/mac/spinbutt.h"
+ #include "wx/mac/spinbutt.h"
#elif defined(__WXSTUBS__)
-#include "wx/stubs/spinbutt.h"
+ #include "wx/stubs/spinbutt.h"
#endif
+// ----------------------------------------------------------------------------
+// the wxSpinButton event
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxSpinEvent : public wxScrollEvent
+{
+ DECLARE_DYNAMIC_CLASS(wxSpinEvent)
+
+public:
+ wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
+ : wxScrollEvent(commandType, id)
+ {
+ }
+};
+
+typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
+
+// macros for handling spin events
+#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
+#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func }
+
+#define EVT_SPIN(id, func) \
+ { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
+ { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
+ { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
+ { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
+ { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
+ { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },\
+ { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
+
+#endif // wxUSE_SPINBTN
+
#endif
// _WX_SPINBUTT_H_BASE_
#include "wx/generic/textdlgg.h"
#endif
+// ----------------------------------------------------------------------------
+// function to get a number from user
+// ----------------------------------------------------------------------------
+
+long WXDLLEXPORT
+wxGetNumberFromUser(const wxString& message,
+ const wxString& prompt,
+ const wxString& caption,
+ long value = 0,
+ long min = 0,
+ long max = 100,
+ wxWindow *parent = (wxWindow *)NULL,
+ const wxPoint& pos = wxDefaultPosition);
+
#endif
// _WX_TEXTDLG_H_BASE_
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
+ (void)new wxTextCtrl(this, -1, "Hi!", wxPoint(20, 20),
+ wxSize(100, 30));
+
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2);
msgTitle = wxString(_("File error"));
#if wxUSE_STD_IOSTREAM
- ofstream store(file.fn_str());
+ ofstream store(wxString(file.fn_str()));
if (store.fail() || store.bad())
#else
- wxFileOutputStream store(file.fn_str());
+ wxFileOutputStream store(wxString(file.fn_str()));
if (store.LastError() != 0)
#endif
{
msgTitle = wxString(_("File error"));
#if wxUSE_STD_IOSTREAM
- ifstream store(file.fn_str());
+ ifstream store(wxString(file.fn_str()));
if (store.fail() || store.bad())
#else
- wxFileInputStream store(file.fn_str());
+ wxFileInputStream store(wxString(file.fn_str()));
if (store.LastError() != 0)
#endif
{
#pragma hdrstop
#endif
+#if !wxUSE_SOCKETS
+ #undef wxUSE_FS_ZIP
+ #undef wxUSE_FS_INET
+ #define wxUSE_FS_ZIP 0
+ #define wxUSE_FS_INET 0
+#endif
+
#if (wxUSE_FS_INET || wxUSE_FS_ZIP) && wxUSE_STREAMS
#include "wx/wfstream.h"
#pragma hdrstop
#endif
+#if !wxUSE_SOCKETS
+ #undef wxUSE_FS_INET
+ #define wxUSE_FS_INET 0
+#endif
+
#if wxUSE_FS_INET
#ifndef WXPRECOMP
#pragma hdrstop
#endif
+#if !wxUSE_SOCKETS
+ #undef wxUSE_FS_ZIP
+ #define wxUSE_FS_ZIP 0
+#endif
+
#if wxUSE_FS_ZIP
#ifndef WXPRECOMP
int rshift = 0, gshift = 0, bshift = 0;
wxUint8 aByte;
wxUint16 aWord;
- wxInt32 dbuf[4], aDword,
+ wxInt32 dbuf[4], aDword,
rmask = 0, gmask = 0, bmask = 0;
wxInt8 bbuf[4];
struct _cmap {
unsigned char r, g, b;
} *cmap = NULL;
-
+
off_t start_offset = stream.TellI();
image->Destroy();
stream.Read( &bbuf, 2 );
stream.Read( dbuf, 4 * 4 );
+#if 0 // unused
wxInt32 size = wxINT32_SWAP_ON_BE( dbuf[0] );
+#endif
wxInt32 offset = wxINT32_SWAP_ON_BE( dbuf[2] );
stream.Read(dbuf, 4 * 2);
wxLogError( _T("Image height > 32767 pixels for file.") );
return FALSE;
}
-
+
stream.Read( &aWord, 2 );
/*
TODO
wxLogError( _T("unknown bitdepth in file.") );
return FALSE;
}
-
+
stream.Read( dbuf, 4 * 4 );
int comp = (int)wxINT32_SWAP_ON_BE( dbuf[0] );
if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS)
wxLogError( _T("unknown encoding in Windows BMP file.") );
return FALSE;
}
-
+
stream.Read( dbuf, 4 * 2 );
int ncolors = (int)wxINT32_SWAP_ON_BE( dbuf[0] );
if (ncolors == 0)
ncolors = 1 << bpp;
/* some more sanity checks */
- if (((comp == BI_RLE4) && (bpp != 4)) ||
- ((comp == BI_RLE8) && (bpp != 8)) ||
- ((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32)))
+ if (((comp == BI_RLE4) && (bpp != 4)) ||
+ ((comp == BI_RLE8) && (bpp != 8)) ||
+ ((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32)))
{
wxLogError( _T("encoding of BMP doesn't match bitdepth.") );
return FALSE;
}
ptr = data;
}
-
+
int line = 0;
int column = 0;
int linesize = ((width * bpp + 31) / 32) * 4;
/* BMPs are stored upside down */
- for (line = (height - 1); line >= 0; line--)
+ for (line = (height - 1); line >= 0; line--)
{
int linepos = 0;
for (column = 0; column < width;)
{
unsigned char temp;
stream.Read( &aWord, 2 );
- aWord = wxUINT16_SWAP_ON_BE( aWord );
+ aWord = wxUINT16_SWAP_ON_BE( aWord );
linepos += 2;
temp = (aWord & rmask) >> rshift;
ptr[poffset] = temp;
{
unsigned char temp;
stream.Read( &aDword, 4 );
- aDword = wxINT32_SWAP_ON_BE( aDword );
+ aDword = wxINT32_SWAP_ON_BE( aDword );
linepos += 4;
temp = (aDword & rmask) >> rshift;
ptr[poffset] = temp;
break;
}
}
- if (cmap)
+ if (cmap)
free(cmap);
image->SetMask( FALSE );
class wxSocketState : public wxObject {
public:
- bool notify_state;
+ bool notify_state;
GSocketEventFlags evt_notify_state;
wxSocketBase::wxSockFlags socket_flags;
wxSocketBase::wxSockCbk c_callback;
bool wxSocketBase::Close()
{
- if (m_socket)
+ if (m_socket)
{
if (m_notify_state == TRUE)
Notify(FALSE);
old_event_flags = NeededReq();
old_notify_state = m_notify_state;
-
+
SetNotify(GSOCK_INPUT_FLAG | GSOCK_LOST_FLAG);
Notify(TRUE);
SaveState();
SetFlags(NOWAIT | SPEED);
- while (recv_size == MAX_BUFSIZE)
+ while (recv_size == MAX_BUFSIZE)
{
recv_size = Read(my_data, MAX_BUFSIZE).LastCount();
}
GSocketEventFlags wxSocketBase::EventToNotify(GSocketEvent evt)
{
- switch (evt)
+ switch (evt)
{
case GSOCK_INPUT:
return GSOCK_INPUT_FLAG;
m_unread = tmp;
}
-
+
m_unrd_size += size;
memcpy(m_unread, buffer, size);
void wxSocketClient::OnRequest(GSocketEvent evt)
{
- if (evt == GSOCK_CONNECTION)
+ if (evt == GSOCK_CONNECTION)
{
- if (m_connected)
+ if (m_connected)
{
m_neededreq &= ~GSOCK_CONNECTION_FLAG;
return;
#pragma hdrstop
#endif
+#if wxUSE_HELP
+
#ifndef WX_PRECOMP
#include "wx/setup.h"
#include "wx/string.h"
#endif
IMPLEMENT_CLASS(wxExtHelpController, wxHTMLHelpControllerBase)
-
+
/**
This class implements help via an external browser.
It requires the name of a directory containing the documentation
long success;
command << m_BrowserName << _T(" -remote openURL(")
<< _T("file://") << m_MapFile
- << WXEXTHELP_SEPARATOR << relativeURL << _T(")");
+ << WXEXTHELP_SEPARATOR << relativeURL << _T(")");
success = wxExecute(command);
if(success != 0 ) // returns PID on success
return TRUE;
}
command = m_BrowserName;
command << _T(" file://")
- << m_MapFile << WXEXTHELP_SEPARATOR << relativeURL;
- return wxExecute(command) != 0;
+ << m_MapFile << WXEXTHELP_SEPARATOR << relativeURL;
+ return wxExecute(command) != 0;
#endif
}
+#endif // wxUSE_HELP
#pragma hdrstop
#endif
+#if wxUSE_HELP
+
#ifndef WX_PRECOMP
#include "wx/setup.h"
#include "wx/string.h"
{
}
+#endif // wxUSE_HELP
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: numdlgg.cpp
+// Purpose: wxGetNumberFromUser implementation
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 23.07.99
+// RCS-ID: $Id$
+// Copyright: (c) Vadim Zeitlin
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma interface "numdlgg.h"
+ #pragma implementation "numdlgg.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include <stdio.h>
+
+ #include "wx/utils.h"
+ #include "wx/dialog.h"
+ #include "wx/button.h"
+ #include "wx/stattext.h"
+ #include "wx/textctrl.h"
+ #include "wx/intl.h"
+#endif
+
+// this is where wxGetNumberFromUser() is declared
+#include "wx/generic/textdlgg.h"
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxNumberEntryDialog : public wxDialog
+{
+public:
+ wxNumberEntryDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& prompt,
+ const wxString& caption,
+ long value, long min, long max,
+ const wxPoint& pos);
+
+ long GetValue() const { return m_value; }
+
+ // implementation only
+ void OnOK(wxCommandEvent& event);
+ void OnCancel(wxCommandEvent& event);
+
+protected:
+ wxTextCtrl *m_spinctrl; // TODO replace it with wxSpinCtrl once it's done
+
+ long m_value, m_min, m_max;
+
+private:
+ DECLARE_EVENT_TABLE()
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxNumberEntryDialog
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(wxNumberEntryDialog, wxDialog)
+ EVT_BUTTON(wxID_OK, wxNumberEntryDialog::OnOK)
+ EVT_BUTTON(wxID_CANCEL, wxNumberEntryDialog::OnCancel)
+END_EVENT_TABLE()
+
+wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& prompt,
+ const wxString& caption,
+ long value,
+ long min,
+ long max,
+ const wxPoint& pos)
+ : wxDialog(parent, -1, caption,
+ pos, wxDefaultSize,
+ wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
+{
+ // init members
+ // ------------
+
+ m_value = value;
+ m_max = max;
+ m_min = min;
+
+ // calculate the sizes
+ // -------------------
+
+ wxArrayString lines;
+ wxSize sizeText = SplitTextMessage(message, &lines);
+
+ wxSize sizeBtn = GetStandardButtonSize();
+
+ int wPrompt, hPrompt;
+ GetTextExtent(prompt, &wPrompt, &hPrompt);
+
+ long wText = wxMax(2*sizeBtn.GetWidth(),
+ wxMax(wPrompt, sizeText.GetWidth()));
+ long hText = GetStandardTextHeight();
+
+ long wDialog = 5*LAYOUT_X_MARGIN + wText + wPrompt;
+ long hDialog = 2*LAYOUT_Y_MARGIN +
+ sizeText.GetHeight() * lines.GetCount() +
+ 2*LAYOUT_Y_MARGIN +
+ hText +
+ 2*LAYOUT_Y_MARGIN +
+ sizeBtn.GetHeight() +
+ 2*LAYOUT_Y_MARGIN;
+
+ // create the controls
+ // -------------------
+
+ // message
+ long x = 2*LAYOUT_X_MARGIN;
+ long y = CreateTextMessage(lines,
+ wxPoint(x, 2*LAYOUT_Y_MARGIN),
+ sizeText);
+
+ y += 2*LAYOUT_X_MARGIN;
+
+ // prompt
+ (void)new wxStaticText(this, -1, prompt,
+ wxPoint(x, y),
+ wxSize(wPrompt, hPrompt));
+
+ // spin ctrl
+ wxString valStr;
+ valStr.Printf("%lu", m_value);
+ m_spinctrl = new wxTextCtrl(this, -1, valStr,
+ wxPoint(x + wPrompt + LAYOUT_X_MARGIN, y),
+ wxSize(wText, hText));
+ y += hText + 2*LAYOUT_X_MARGIN;
+
+ // and buttons
+ CreateStandardButtons(wDialog, y, sizeBtn.GetWidth(), sizeBtn.GetHeight());
+
+ // set the dialog size and position
+ SetClientSize(wDialog, hDialog);
+ if ( pos == wxDefaultPosition )
+ {
+ // centre the dialog if no explicit position given
+ Centre(wxBOTH | wxCENTER_FRAME);
+ }
+
+ m_spinctrl->SetFocus();
+}
+
+void wxNumberEntryDialog::OnOK(wxCommandEvent& event)
+{
+ if ( (sscanf(m_spinctrl->GetValue(), "%lu", &m_value) != 1) ||
+ (m_value < m_min) || (m_value > m_max) )
+ {
+ // not a number or out of range
+ m_value = -1;
+ }
+
+ EndModal(wxID_OK);
+}
+
+void wxNumberEntryDialog::OnCancel(wxCommandEvent& event)
+{
+ m_value = -1;
+
+ EndModal(wxID_CANCEL);
+}
+
+// ----------------------------------------------------------------------------
+// global functions
+// ----------------------------------------------------------------------------
+
+// wxGetTextFromUser is in utilscmn.cpp
+
+long wxGetNumberFromUser(const wxString& msg,
+ const wxString& prompt,
+ const wxString& title,
+ long value,
+ long min,
+ long max,
+ wxWindow *parent,
+ const wxPoint& pos)
+{
+ wxNumberEntryDialog dialog(parent, msg, prompt, title,
+ value, min, max, pos);
+ (void)dialog.ShowModal();
+
+ return dialog.GetValue();
+}
#include "wx/generic/textdlgg.h"
-// ----------------------------------------------------------------------------
-// private classes
-// ----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxNumberEntryDialog : public wxDialog
-{
-public:
- wxNumberEntryDialog(wxWindow *parent,
- const wxString& message,
- const wxString& prompt,
- const wxString& caption,
- long value, long min, long max,
- const wxPoint& pos);
-
- long GetValue() const { return m_value; }
-
- // implementation only
- void OnOK(wxCommandEvent& event);
- void OnCancel(wxCommandEvent& event);
-
-protected:
- wxTextCtrl *m_spinctrl; // TODO replace it with wxSpinCtrl once it's done
-
- long m_value, m_min, m_max;
-
-private:
- DECLARE_EVENT_TABLE()
-};
-
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
-BEGIN_EVENT_TABLE(wxNumberEntryDialog, wxDialog)
- EVT_BUTTON(wxID_OK, wxNumberEntryDialog::OnOK)
- EVT_BUTTON(wxID_CANCEL, wxNumberEntryDialog::OnCancel)
-END_EVENT_TABLE()
-
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE()
EndModal(wxID_OK);
}
-
-// ----------------------------------------------------------------------------
-// wxNumberEntryDialog
-// ----------------------------------------------------------------------------
-
-wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent,
- const wxString& message,
- const wxString& prompt,
- const wxString& caption,
- long value,
- long min,
- long max,
- const wxPoint& pos)
- : wxDialog(parent, -1, caption,
- pos, wxDefaultSize,
- wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
-{
- // init members
- // ------------
-
- m_value = value;
- m_max = max;
- m_min = min;
-
- // calculate the sizes
- // -------------------
-
- wxArrayString lines;
- wxSize sizeText = SplitTextMessage(message, &lines);
-
- wxSize sizeBtn = GetStandardButtonSize();
-
- int wPrompt, hPrompt;
- GetTextExtent(prompt, &wPrompt, &hPrompt);
-
- long wText = wxMax(2*sizeBtn.GetWidth(),
- wxMax(wPrompt, sizeText.GetWidth()));
- long hText = GetStandardTextHeight();
-
- long wDialog = 5*LAYOUT_X_MARGIN + wText + wPrompt;
- long hDialog = 2*LAYOUT_Y_MARGIN +
- sizeText.GetHeight() * lines.GetCount() +
- 2*LAYOUT_Y_MARGIN +
- hText +
- 2*LAYOUT_Y_MARGIN +
- sizeBtn.GetHeight() +
- 2*LAYOUT_Y_MARGIN;
-
- // create the controls
- // -------------------
-
- // message
- long x = 2*LAYOUT_X_MARGIN;
- long y = CreateTextMessage(lines,
- wxPoint(x, 2*LAYOUT_Y_MARGIN),
- sizeText);
-
- y += 2*LAYOUT_X_MARGIN;
-
- // prompt
- (void)new wxStaticText(this, -1, prompt,
- wxPoint(x, y),
- wxSize(wPrompt, hPrompt));
-
- // spin ctrl
- wxString valStr;
- valStr.Printf("%lu", m_value);
- m_spinctrl = new wxTextCtrl(this, -1, valStr,
- wxPoint(x + wPrompt + LAYOUT_X_MARGIN, y),
- wxSize(wText, hText));
- y += hText + 2*LAYOUT_X_MARGIN;
-
- // and buttons
- CreateStandardButtons(wDialog, y, sizeBtn.GetWidth(), sizeBtn.GetHeight());
-
- // set the dialog size and position
- SetClientSize(wDialog, hDialog);
- if ( pos == wxDefaultPosition )
- {
- // centre the dialog if no explicit position given
- Centre(wxBOTH | wxCENTER_FRAME);
- }
-
- m_spinctrl->SetFocus();
-}
-
-void wxNumberEntryDialog::OnOK(wxCommandEvent& event)
-{
- if ( (sscanf(m_spinctrl->GetValue(), "%lu", &m_value) != 1) ||
- (m_value < m_min) || (m_value > m_max) )
- {
- // not a number or out of range
- m_value = -1;
- }
-
- EndModal(wxID_OK);
-}
-
-void wxNumberEntryDialog::OnCancel(wxCommandEvent& event)
-{
- m_value = -1;
-
- EndModal(wxID_CANCEL);
-}
-
-// ----------------------------------------------------------------------------
-// global functions
-// ----------------------------------------------------------------------------
-
-// wxGetTextFromUser is in utilscmn.cpp
-
-long wxGetNumberFromUser(const wxString& msg,
- const wxString& prompt,
- const wxString& title,
- long value,
- long min,
- long max,
- wxWindow *parent,
- const wxPoint& pos)
-{
- wxNumberEntryDialog dialog(parent, msg, prompt, title,
- value, min, max, pos);
- (void)dialog.ShowModal();
-
- return dialog.GetValue();
-}
imaglist.cpp \
laywin.cpp \
listctrl.cpp \
+ numdlgg.cpp \
panelg.cpp \
printps.cpp \
prntdlgg.cpp \
event.SetInt( combo->GetSelection() );
event.SetString( combo->GetStringSelection() );
event.SetEventObject( combo );
-
+
combo->GetEventHandler()->ProcessEvent( event );
}
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
if (g_isIdle) wxapp_install_idle_handler();
-
+
if (!combo->m_hasVMT) return;
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
/* don't send first event, which GTK sends aways when
inserting the first item */
m_alreadySent = TRUE;
-
+
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
m_clientDataList.Append( (wxObject*)NULL );
}
}
- wxFAIL_MSG( _T("wxComboBox: no selection") );
-
return -1;
}
GList *child = list->children;
while (child)
{
- gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
+ gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
child = child->next;
void wxComboBox::OnSize( wxSizeEvent &event )
{
event.Skip();
-
+
return;
int w = 21;
IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
-wxControl::wxControl(void)
+wxControl::wxControl()
{
m_needParent = TRUE;
}
-wxControl::wxControl( wxWindow *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size,
- long style, const wxString &name ) :
- wxWindow( parent, id, pos, size, style, name )
+wxControl::wxControl( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name )
+ : wxWindow( parent, id, pos, size, style, name )
{
}
void wxControl::SetLabel( const wxString &label )
{
m_label = _T("");
- for ( const wxChar *pc = label; *pc != _T('\0'); pc++ )
+ for ( const wxChar *pc = label; *pc != _T('\0'); pc++ )
{
- if ( *pc == _T('&') )
- {
+ if ( *pc == _T('&') )
+ {
pc++; // skip it
#if 0 // it would be unused anyhow for now - kbd interface not done yet
if ( *pc != _T('&') ) m_chAccel = *pc;
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton,wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
BEGIN_EVENT_TABLE(wxSpinButton, wxControl)
EVT_SIZE(wxSpinButton::OnSize)
END_EVENT_TABLE()
-wxSpinButton::wxSpinButton()
-{
-}
-
-bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
- long style, const wxString& name)
+bool wxSpinButton::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
{
m_needParent = TRUE;
gtk_widget_set_style( m_widget, m_widgetStyle );
}
-//-----------------------------------------------------------------------------
-// wxSpinEvent
-//-----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
-
-wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
- wxScrollEvent(commandType, id)
-{
-}
-
-#endif
\ No newline at end of file
+#endif
/* insert GTK representation */
(*m_parent->m_insertCallback)(m_parent, this);
-
+
gtk_widget_show( m_widget );
PostCreation();
PostCreation();
}
-
+
m_parent->DoAddChild( this );
Show( TRUE );
{
gtk_widget_destroy( m_widget );
- /* recreate m_widget because we've created a label
- and not a bitmap above */
+ /* recreate m_widget because we've created a label
+ and not a bitmap above */
CreatePixmapWidget();
}
- else
- {
+ else
+ {
GdkBitmap *mask = (GdkBitmap *) NULL;
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
- }
-
+ }
+
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
}
}
imaglist.cpp \
laywin.cpp \
listctrl.cpp \
+ numdlgg.cpp \
panelg.cpp \
printps.cpp \
prntdlgg.cpp \
event.SetInt( combo->GetSelection() );
event.SetString( combo->GetStringSelection() );
event.SetEventObject( combo );
-
+
combo->GetEventHandler()->ProcessEvent( event );
}
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
if (g_isIdle) wxapp_install_idle_handler();
-
+
if (!combo->m_hasVMT) return;
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
/* don't send first event, which GTK sends aways when
inserting the first item */
m_alreadySent = TRUE;
-
+
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
m_clientDataList.Append( (wxObject*)NULL );
}
}
- wxFAIL_MSG( _T("wxComboBox: no selection") );
-
return -1;
}
GList *child = list->children;
while (child)
{
- gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
+ gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
child = child->next;
void wxComboBox::OnSize( wxSizeEvent &event )
{
event.Skip();
-
+
return;
int w = 21;
IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
-wxControl::wxControl(void)
+wxControl::wxControl()
{
m_needParent = TRUE;
}
-wxControl::wxControl( wxWindow *parent, wxWindowID id,
- const wxPoint &pos, const wxSize &size,
- long style, const wxString &name ) :
- wxWindow( parent, id, pos, size, style, name )
+wxControl::wxControl( wxWindow *parent,
+ wxWindowID id,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxString &name )
+ : wxWindow( parent, id, pos, size, style, name )
{
}
void wxControl::SetLabel( const wxString &label )
{
m_label = _T("");
- for ( const wxChar *pc = label; *pc != _T('\0'); pc++ )
+ for ( const wxChar *pc = label; *pc != _T('\0'); pc++ )
{
- if ( *pc == _T('&') )
- {
+ if ( *pc == _T('&') )
+ {
pc++; // skip it
#if 0 // it would be unused anyhow for now - kbd interface not done yet
if ( *pc != _T('&') ) m_chAccel = *pc;
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton,wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
BEGIN_EVENT_TABLE(wxSpinButton, wxControl)
EVT_SIZE(wxSpinButton::OnSize)
END_EVENT_TABLE()
-wxSpinButton::wxSpinButton()
-{
-}
-
-bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
- long style, const wxString& name)
+bool wxSpinButton::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
{
m_needParent = TRUE;
gtk_widget_set_style( m_widget, m_widgetStyle );
}
-//-----------------------------------------------------------------------------
-// wxSpinEvent
-//-----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
-
-wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
- wxScrollEvent(commandType, id)
-{
-}
-
-#endif
\ No newline at end of file
+#endif
/* insert GTK representation */
(*m_parent->m_insertCallback)(m_parent, this);
-
+
gtk_widget_show( m_widget );
PostCreation();
PostCreation();
}
-
+
m_parent->DoAddChild( this );
Show( TRUE );
{
gtk_widget_destroy( m_widget );
- /* recreate m_widget because we've created a label
- and not a bitmap above */
+ /* recreate m_widget because we've created a label
+ and not a bitmap above */
CreatePixmapWidget();
}
- else
- {
+ else
+ {
GdkBitmap *mask = (GdkBitmap *) NULL;
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
- }
-
+ }
+
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
}
}
docview.cpp \
dynlib.cpp \
event.cpp \
+ ffile.cpp \
file.cpp \
fileconf.cpp \
filesys.cpp \
stream.cpp \
tbarbase.cpp \
tbarsmpl.cpp \
+ textcmn.cpp \
textfile.cpp \
txtstrm.cpp \
time.cpp \
imaglist.cpp \
laywin.cpp \
listctrl.cpp \
+ numdlgg.cpp \
panelg.cpp \
printps.cpp \
prntdlgg.cpp \
if (event->type == KeyPress)
{
+#ifdef __WXDEBUG__
+ Widget widget = XtWindowToWidget(event->xany.display, event->xany.window);
+ wxLogDebug("Got key press event for 0x%08x (parent = 0x%08x)",
+ widget, XtParent(widget));
+#endif // DEBUG
+
if (CheckForAccelerator(_event))
{
// Do nothing! We intercepted and processed the event as an
bool wxApp::CheckForKeyDown(WXEvent* event)
{
XEvent* xEvent = (XEvent*) event;
- // VZ: this code doesn't work for me because it never finds the correct
- // window. Also, if we go this way, we should generate KEY_UP and
- // CHAR events as well, not only KEY_DOWN.
-#if 0
if (xEvent->xany.type == KeyPress)
{
Widget widget = XtWindowToWidget((Display*) wxGetDisplay(),
win->ProcessEvent( keyEvent );
return (keyEvent.GetSkipped() != TRUE);
}
-#endif // 0
return FALSE;
}
#include "wx/motif/private.h"
-#if wxUSE_XPM
-#include <X11/xpm.h>
+#if wxHAVE_LIB_XPM
+ #include <X11/xpm.h>
#endif
#if !USE_SHARED_LIBRARIES
-IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
-IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
+ IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
+ IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
#endif
wxBitmapRefData::wxBitmapRefData()
m_quality = 0;
m_numColors = 0;
m_bitmapMask = NULL;
-
+
m_pixmap = (WXPixmap) 0;
m_display = (WXDisplay*) 0;
-
+
m_freePixmap = TRUE; //TODO: necessary?
m_freeColors = (unsigned long*) 0;
m_freeColorsCount = 0;
-
+
// These 5 variables are for wxControl
m_insensPixmap = (WXPixmap) 0;
m_labelPixmap = (WXPixmap) 0;
{
if (m_labelPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_labelPixmap);
-
+
if (m_armPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_armPixmap);
-
+
if (m_insensPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_insensPixmap);
-
+
if (m_image)
{
XmUninstallImage ((XImage*) m_image);
XtFree ((char *) (XImage*) m_image);
}
-
+
if (m_insensImage)
{
XmUninstallImage ((XImage*) m_insensImage);
}
if (m_pixmap && m_freePixmap)
XFreePixmap ((Display*) m_display, (Pixmap) m_pixmap);
-
+
if (m_freeColors)
{
int screen = DefaultScreen((Display*) m_display);
XFreeColors((Display*) m_display, cmp, &m_freeColors[llp], 1, 0L);
delete m_freeColors;
};
-
+
if (m_bitmapMask)
delete m_bitmapMask;
m_bitmapMask = NULL;
wxBitmap::wxBitmap()
{
m_refData = NULL;
-
+
if ( wxTheBitmapList )
wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
{
m_refData = new wxBitmapRefData;
-
+
(void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, depth);
-
+
if ( wxTheBitmapList )
wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap(int w, int h, int d)
{
(void)Create(w, h, d);
-
+
if ( wxTheBitmapList )
wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth)
{
(void) Create(data, type, width, height, depth);
-
+
if ( wxTheBitmapList )
wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap(const wxString& filename, long type)
{
LoadFile(filename, (int)type);
-
+
if ( wxTheBitmapList )
wxTheBitmapList->AddBitmap(this);
}
{
// Pass the control to the Create function using a global
sg_Control = control;
-
+
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
-
+
sg_Control = (wxControl*) NULL;
}
bool wxBitmap::Create(int w, int h, int d)
{
UnRef();
-
+
m_refData = new wxBitmapRefData;
-
+
if (d < 1)
d = wxDisplayDepth();
-
+
M_BITMAPDATA->m_width = w;
M_BITMAPDATA->m_height = h;
M_BITMAPDATA->m_depth = d;
M_BITMAPDATA->m_freePixmap = TRUE;
-
+
Display *dpy = (Display*) wxGetDisplay();
-
+
M_BITMAPDATA->m_display = dpy; /* MATTHEW: [4] Remember the display */
-
+
M_BITMAPDATA->m_pixmap = (WXPixmap) XCreatePixmap (dpy, RootWindow (dpy, DefaultScreen (dpy)),
w, h, d);
-
+
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_pixmap != (WXPixmap) 0) ;
return M_BITMAPDATA->m_ok;
}
bool wxBitmap::LoadFile(const wxString& filename, long type)
{
UnRef();
-
+
m_refData = new wxBitmapRefData;
-
+
wxBitmapHandler *handler = FindHandler(type);
-
+
if ( handler == NULL ) {
wxLogWarning("%s: no bitmap handler for type %d defined.", (const char*) filename, type);
-
+
return FALSE;
}
-
+
return handler->LoadFile(this, filename, type, -1, -1);
}
bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
{
UnRef();
-
+
m_refData = new wxBitmapRefData;
-
+
wxBitmapHandler *handler = FindHandler(type);
-
+
if ( handler == NULL ) {
wxLogWarning("no data bitmap handler for type %d defined.", type);
-
+
return FALSE;
}
-
+
return handler->Create(this, data, type, width, height, depth);
}
bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *palette)
{
wxBitmapHandler *handler = FindHandler(type);
-
+
if ( handler == NULL ) {
wxLogWarning("no bitmap handler for type %d defined.", type);
-
+
return FALSE;
}
-
+
return handler->SaveFile(this, filename, type, palette);
}
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
-
+
M_BITMAPDATA->m_width = w;
}
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
-
+
M_BITMAPDATA->m_height = h;
}
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
-
+
M_BITMAPDATA->m_depth = d;
}
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
-
+
M_BITMAPDATA->m_quality = q;
}
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
-
+
M_BITMAPDATA->m_ok = isOk;
}
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
-
+
M_BITMAPDATA->m_bitmapPalette = palette ;
}
{
if (!M_BITMAPDATA)
m_refData = new wxBitmapRefData;
-
+
M_BITMAPDATA->m_bitmapMask = mask ;
}
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
{
m_pixmap = (WXPixmap) 0;
-
+
Create(bitmap, colour);
}
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
{
m_pixmap = (WXPixmap) 0;
-
+
Create(bitmap, paletteIndex);
}
wxMask::wxMask(const wxBitmap& bitmap)
{
m_pixmap = (WXPixmap) 0;
-
+
Create(bitmap);
}
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
-bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(type),
+bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(type),
int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth))
{
return FALSE;
return FALSE;
}
-bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), int WXUNUSED(type),
+bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), int WXUNUSED(type),
const wxPalette *WXUNUSED(palette))
{
return FALSE;
m_extension = "xbm";
m_type = wxBITMAP_TYPE_XBM;
};
-
+
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
};
int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight))
{
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
-
+
int hotX, hotY;
unsigned int w, h;
Pixmap pixmap;
-
+
Display *dpy = (Display*) wxGetDisplay();
M_BITMAPDATA->m_display = (WXDisplay*) dpy;
-
+
int value = XReadBitmapFile (dpy, RootWindow (dpy, DefaultScreen (dpy)),
(char*) (const char*) name, &w, &h, &pixmap, &hotX, &hotY);
M_BITMAPHANDLERDATA->m_width = w;
M_BITMAPHANDLERDATA->m_height = h;
M_BITMAPHANDLERDATA->m_depth = 1;
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap;
-
+
if ((value == BitmapFileInvalid) ||
(value == BitmapOpenFailed) ||
(value == BitmapNoMemory))
}
else
M_BITMAPHANDLERDATA->m_ok = TRUE;
-
+
return M_BITMAPHANDLERDATA->m_ok ;
}
m_extension = "xbm";
m_type = wxBITMAP_TYPE_XBM_DATA;
};
-
+
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
};
IMPLEMENT_DYNAMIC_CLASS(wxXBMDataHandler, wxBitmapHandler)
-bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags),
+bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags),
int width, int height, int WXUNUSED(depth))
{
M_BITMAPHANDLERDATA->m_width = width;
M_BITMAPHANDLERDATA->m_height = height;
M_BITMAPHANDLERDATA->m_depth = 1;
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
-
+
Display *dpy = (Display*) wxGetDisplay();
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
-
+
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) XCreateBitmapFromData (dpy, RootWindow (dpy, DefaultScreen (dpy)), (char*) data, width, height);
M_BITMAPHANDLERDATA->m_ok = (M_BITMAPHANDLERDATA->m_pixmap != (WXPixmap) 0) ;
-
+
// code for wxControl. TODO: can we avoid doing this until we need it?
// E.g. have CreateButtonPixmaps which is called on demand.
XImage* image = (XImage *) XtMalloc (sizeof (XImage));
image->bitmap_bit_order = LSBFirst;
image->bitmap_pad = 8;
image->bytes_per_line = (width + 7) >> 3;
-
+
char tmp[128];
sprintf (tmp, "Im%x", (unsigned int) image);
XmInstallImage (image, tmp);
-
+
// Build our manually stipped pixmap.
-
+
int bpl = (width + 7) / 8;
char *data1 = new char[height * bpl];
char* bits = (char*) data;
insensImage->bitmap_bit_order = LSBFirst;
insensImage->bitmap_pad = 8;
insensImage->bytes_per_line = bpl;
-
+
sprintf (tmp, "Not%x", (unsigned int)insensImage);
XmInstallImage (insensImage, tmp);
-
+
M_BITMAPHANDLERDATA->m_image = (WXImage*) image;
M_BITMAPHANDLERDATA->m_insensImage = (WXImage*) insensImage;
-
+
return TRUE;
}
-#if wxUSE_XPM
+#if wxHAVE_LIB_XPM
class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
m_extension = "xpm";
m_type = wxBITMAP_TYPE_XPM;
};
-
+
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
{
Display *dpy = (Display*) wxGetDisplay();
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
-
+
XpmAttributes xpmAttr;
Pixmap pixmap;
Pixmap mask = 0;
-
+
M_BITMAPHANDLERDATA->m_ok = FALSE;
xpmAttr.valuemask = XpmReturnInfos | XpmCloseness;
xpmAttr.closeness = 40000;
int errorStatus = XpmReadFileToPixmap(dpy,
RootWindow(dpy, DefaultScreen(dpy)), (char*) (const char*) name,
&pixmap, &mask, &xpmAttr);
-
+
if (errorStatus == XpmSuccess)
{
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap;
M_BITMAPHANDLERDATA->m_bitmapMask = new wxMask;
M_BITMAPHANDLERDATA->m_bitmapMask->SetPixmap((WXPixmap) mask);
}
-
+
unsigned int depthRet;
int xRet, yRet;
unsigned int widthRet, heightRet, borderWidthRet;
Window rootWindowRet;
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
&widthRet, &heightRet, &borderWidthRet, &depthRet);
-
+
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
-
+
/*
if ( xpmAttr.npixels > 2 )
{
M_BITMAPHANDLERDATA->m_depth = 1; // mono
}
*/
-
+
M_BITMAPHANDLERDATA->m_depth = depthRet;
-
+
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
-
+
XpmFreeAttributes(&xpmAttr);
-
+
M_BITMAPHANDLERDATA->m_ok = TRUE;
return TRUE;
} else
}
}
-bool wxXPMFileHandler::SaveFile( wxBitmap *bitmap, const wxString& name, int WXUNUSED(type),
+bool wxXPMFileHandler::SaveFile( wxBitmap *bitmap, const wxString& name, int WXUNUSED(type),
const wxPalette *WXUNUSED(palette))
{
if (M_BITMAPHANDLERDATA->m_ok && M_BITMAPHANDLERDATA->m_pixmap)
m_extension = "xpm";
m_type = wxBITMAP_TYPE_XPM_DATA;
};
-
+
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
};
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
-bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags),
+bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags),
int width, int height, int WXUNUSED(depth))
{
M_BITMAPHANDLERDATA->m_width = width;
M_BITMAPHANDLERDATA->m_height = height;
M_BITMAPHANDLERDATA->m_depth = 1;
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
-
+
Display *dpy = (Display*) wxGetDisplay();
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
-
+
XpmAttributes xpmAttr;
-
+
xpmAttr.valuemask = XpmReturnInfos; /* nothing yet, but get infos back */
-
+
XpmColorSymbol symbolicColors[4];
if (sg_Control && sg_Control->GetMainWidget())
{
xpmAttr.colorsymbols = symbolicColors;
xpmAttr.valuemask |= XpmColorSymbols; // add flag
}
-
+
Pixmap pixmap;
Pixmap mask = 0;
int ErrorStatus = XpmCreatePixmapFromData(dpy, RootWindow(dpy, DefaultScreen(dpy)),
// Set attributes
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
-
+
unsigned int depthRet;
int xRet, yRet;
unsigned int widthRet, heightRet, borderWidthRet;
Window rootWindowRet;
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
&widthRet, &heightRet, &borderWidthRet, &depthRet);
-
+
/*
if ( xpmAttr.npixels > 2 )
{
M_BITMAPHANDLERDATA->m_depth = 1; // mono
}
*/
-
+
M_BITMAPHANDLERDATA->m_depth = depthRet;
-
+
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
XpmFreeAttributes(&xpmAttr);
M_BITMAPHANDLERDATA->m_ok = TRUE;
return M_BITMAPHANDLERDATA->m_ok ;
}
-#endif
+#endif // wxHAVE_LIB_XPM
void wxBitmap::CleanUpHandlers()
{
// Initialize all standard bitmap or derived class handlers here.
AddHandler(new wxXBMFileHandler);
AddHandler(new wxXBMDataHandler);
-
- // XPM is considered standard for Motif, although it can be omitted if absolutely
- // necessary.
-#if wxUSE_XPM
+
+ // XPM is considered standard for Motif, although it can be omitted if
+ // libXpm is not installed
+#if wxHAVE_LIB_XPM
AddHandler(new wxXPMFileHandler);
AddHandler(new wxXPMDataHandler);
-#endif
+#endif // wxHAVE_LIB_XPM
}
WXPixmap wxBitmap::GetLabelPixmap (WXWidget w)
{
if (M_BITMAPDATA->m_image == (WXPixmap) 0)
return M_BITMAPDATA->m_pixmap;
-
+
Display *dpy = (Display*) M_BITMAPDATA->m_display;
-
+
#ifdef FOO
/*
If we do:
if (labelPixmap) return labelPixmap;
things can be wrong, because colors can have been changed.
-
+
If we do:
if (labelPixmap)
XmDestroyPixmap(DefaultScreenOfDisplay(dpy),labelPixmap) ;
we got BadDrawable if the pixmap is referenced by multiples widgets
-
+
this is a catch22!!
-
+
So, before doing thing really clean, I just do nothing; if the pixmap is
referenced by many widgets, Motif performs caching functions.
And if pixmap is referenced with multiples colors, we just have some
if (M_BITMAPDATA->m_labelPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_labelPixmap);
#endif
-
+
char tmp[128];
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
-
+
Pixel fg, bg;
Widget widget = (Widget) w;
-
+
while (XmIsGadget ( widget ))
widget = XtParent (widget);
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
-
+
M_BITMAPDATA->m_labelPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
-
+
return M_BITMAPDATA->m_labelPixmap;
}
{
if (M_BITMAPDATA->m_image == (WXPixmap) 0)
return M_BITMAPDATA->m_pixmap;
-
+
Display *dpy = (Display*) M_BITMAPDATA->m_display;
#ifdef FOO
See GetLabelPixmap () comment
if (M_BITMAPDATA->m_armPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_armPixmap);
#endif
-
+
char tmp[128];
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
-
+
Pixel fg, bg;
Widget widget = (Widget) w;
-
+
XtVaGetValues (widget, XmNarmColor, &bg, NULL);
while (XmIsGadget (widget))
widget = XtParent (widget);
XtVaGetValues (widget, XmNforeground, &fg, NULL);
-
+
M_BITMAPDATA->m_armPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
-
+
return M_BITMAPDATA->m_armPixmap;
}
WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
{
Display *dpy = (Display*) M_BITMAPDATA->m_display;
-
+
if (M_BITMAPDATA->m_insensPixmap)
return M_BITMAPDATA->m_insensPixmap;
-
+
if (!w)
{
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XCreateInsensitivePixmap(dpy, (Pixmap) M_BITMAPDATA->m_pixmap);
else
return M_BITMAPDATA->m_pixmap;
}
-
+
if (M_BITMAPDATA->m_insensImage == (WXPixmap) 0)
return M_BITMAPDATA->m_pixmap;
-
+
#ifdef FOO
See GetLabelPixmap () comment
// Must be destroyed, because colours can have been changed!
if (M_BITMAPDATA->m_insensPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), (Pixmap) M_BITMAPDATA->m_insensPixmap);
#endif
-
+
char tmp[128];
sprintf (tmp, "Not%x", (unsigned int) M_BITMAPDATA->m_insensImage);
-
+
Pixel fg, bg;
Widget widget = (Widget) w;
-
+
while (XmIsGadget (widget))
widget = XtParent (widget);
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
-
+
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
-
+
return M_BITMAPDATA->m_insensPixmap;
}
NAME
XCreateInsensitivePixmap - create a grayed-out copy of a pixmap
-
+
SYNOPSIS
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
-
+
DESCRIPTION
This function creates a grayed-out copy of the argument pixmap, suitable
for use as a XmLabel's XmNlabelInsensitivePixmap resource.
-
+
RETURN VALUES
The return value is the new Pixmap id or zero on error. Errors include
a NULL display argument or an invalid Pixmap argument.
-
+
ERRORS
If one of the XLib functions fail, it will produce a X error. The
default X error handler prints a diagnostic and calls exit().
-
+
SEE ALSO
XCopyArea(3), XCreateBitmapFromData(3), XCreateGC(3), XCreatePixmap(3),
XFillRectangle(3), exit(2)
-
+
AUTHOR
John R Veregge - john@puente.jpl.nasa.gov
Advanced Engineering and Prototyping Group (AEG)
Information Systems Technology Section (395)
Jet Propulsion Lab - Calif Institute of Technology
-
+
*****************************************************************************/
Pixmap
{
static
- char stipple_data[] =
+ char stipple_data[] =
{
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
GC gc;
Pixmap ipixmap, stipple;
unsigned width, height, depth;
-
+
Window window; /* These return values */
unsigned border; /* from XGetGeometry() */
int x, y; /* are not needed. */
-
+
ipixmap = 0;
-
+
if ( NULL == display || 0 == pixmap )
return ipixmap;
-
+
if ( 0 == XGetGeometry( display, pixmap, &window, &x, &y,
&width, &height, &border, &depth )
)
return ipixmap; /* BadDrawable: probably an invalid pixmap */
-
+
/* Get the stipple pixmap to be used to 'gray-out' the argument pixmap.
*/
stipple = XCreateBitmapFromData( display, pixmap, stipple_data, 16, 16 );
*/
XCopyArea( display, pixmap, ipixmap,
gc, 0, 0, width, height, 0, 0 );
-
+
/* Refill the new pixmap using the stipple algorithm/pixmap.
*/
XSetStipple( display, gc, stipple );
wxMemoryDC srcDC;
srcDC.SelectObject(bitmap);
destDC.SelectObject(newBitmap);
-
+
wxBrush brush(colour, wxSOLID);
destDC.SetOptimization(FALSE);
destDC.SetBackground(brush);
destDC.Clear();
destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), & srcDC, 0, 0, wxCOPY, TRUE);
-
+
return newBitmap;
}
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_font = parent->GetFont();
-
+
if (parent) parent->AddChild(this);
-
+
if ( id == -1 )
m_windowId = NewControlId();
else
m_windowId = id;
-
+
char* label1 = (label.IsNull() ? "" : (char*) (const char*) label);
-
+
XmString text = XmStringCreateSimple (label1);
Widget parentWidget = (Widget) parent->GetClientWidget();
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
-
+
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("toggle",
xmToggleButtonWidgetClass, parentWidget,
XmNfontList, fontList,
XmNlabelString, text,
NULL);
XmStringFree (text);
-
+
XtAddCallback ((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc) wxCheckBoxCallback,
(XtPointer) this);
-
+
XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
-
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
-
+
ChangeBackgroundColour();
return TRUE;
}
SetName(name);
SetValidator(validator);
m_windowStyle = style;
-
+
if (parent) parent->AddChild(this);
-
+
if ( id == -1 )
m_windowId = NewControlId();
else
m_windowId = id;
-
+
// TODO: Create the bitmap checkbox
-
+
return FALSE;
}
XtPointer ptr)
{
wxCheckBox *item = (wxCheckBox *) clientData;
-
+
if (item->InSetValue())
return;
-
+
wxCommandEvent event (wxEVT_COMMAND_CHECKBOX_CLICKED, item->GetId());
event.SetInt((int) item->GetValue ());
event.SetEventObject(item);
{
wxComputeColours (XtDisplay((Widget) m_mainWidget), & m_backgroundColour,
(wxColour*) NULL);
-
+
XtVaSetValues ((Widget) m_mainWidget,
XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
NULL);
-
+
int selectPixel = wxBLACK->AllocColour(wxGetDisplay());
// Better to have the checkbox selection in black, or it's
m_menuWidget = (WXWidget) 0;
m_widgetList = (WXWidget*) 0;
m_formWidget = (WXWidget) 0;
-
+
if (parent) parent->AddChild(this);
-
+
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
-
+
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_font = parent->GetFont();
-
+
Widget parentWidget = (Widget) parent->GetClientWidget();
-
- m_formWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) name,
+
+ m_formWidget = (WXWidget) XtVaCreateManagedWidget(name.c_str(),
xmRowColumnWidgetClass, parentWidget,
XmNmarginHeight, 0,
XmNmarginWidth, 0,
XmNpacking, XmPACK_TIGHT,
XmNorientation, XmHORIZONTAL,
NULL);
-
+
XtVaSetValues ((Widget) m_formWidget, XmNspacing, 0, NULL);
-
+
/*
* Create the popup menu
*/
m_menuWidget = (WXWidget) XmCreatePulldownMenu ((Widget) m_formWidget, "choiceMenu", NULL, 0);
-
+
// int i;
if (n > 0)
{
for (i = 0; i < n; i++)
Append (choices[i]);
}
-
+
/*
* Create button
*/
Arg args[10];
Cardinal argcnt = 0;
-
+
XtSetArg (args[argcnt], XmNsubMenuId, (Widget) m_menuWidget);
argcnt++;
XtSetArg (args[argcnt], XmNmarginWidth, 0);
XtSetArg (args[argcnt], XmNpacking, XmPACK_TIGHT);
argcnt++;
m_buttonWidget = (WXWidget) XmCreateOptionMenu ((Widget) m_formWidget, "choiceButton", args, argcnt);
-
+
m_mainWidget = m_buttonWidget;
-
+
XtManageChild ((Widget) m_buttonWidget);
// New code from Roland Haenel (roland_haenel@ac.cybercity.de)
#endif
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
-
+
ChangeFont(FALSE);
AttachWidget (parent, m_buttonWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
-
+
ChangeBackgroundColour();
-
+
return TRUE;
}
// XtDestroyWidget (menuWidget);
if (m_widgetList)
delete[] m_widgetList;
-
+
if (GetMainWidget())
{
DetachWidget(GetMainWidget()); // Removes event handlers
DetachWidget(m_formWidget);
-
+
XtDestroyWidget((Widget) m_formWidget);
m_formWidget = (WXWidget) 0;
-
+
// Presumably the other widgets have been deleted now, via the form
m_mainWidget = (WXWidget) 0;
m_buttonWidget = (WXWidget) 0;
void wxChoice::Append(const wxString& item)
{
- wxStripMenuCodes ((char *)(const char *)item, wxBuffer);
- Widget w = XtVaCreateManagedWidget (wxBuffer,
+ Widget w = XtVaCreateManagedWidget (wxStripMenuCodes(item),
#if USE_GADGETS
xmPushButtonGadgetClass, (Widget) m_menuWidget,
#else
xmPushButtonWidgetClass, (Widget) m_menuWidget,
#endif
NULL);
-
+
DoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
-
+
if (m_font.Ok())
XtVaSetValues (w,
XmNfontList, (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_formWidget)),
NULL);
-
+
WXWidget *new_widgetList = new WXWidget[m_noStrings + 1];
int i;
if (m_widgetList)
for (i = 0; i < m_noStrings; i++)
new_widgetList[i] = m_widgetList[i];
-
+
new_widgetList[m_noStrings] = (WXWidget) w;
-
+
if (m_widgetList)
delete[] m_widgetList;
m_widgetList = new_widgetList;
-
+
char mnem = wxFindMnemonic ((char*) (const char*) item);
if (mnem != 0)
XtVaSetValues (w, XmNmnemonic, mnem, NULL);
-
+
XtAddCallback (w, XmNactivateCallback, (XtCallbackProc) wxChoiceCallback, (XtPointer) this);
-
+
if (m_noStrings == 0 && m_buttonWidget)
{
XtVaSetValues ((Widget) m_buttonWidget, XmNmenuHistory, w, NULL);
}
wxNode *node = m_stringList.Add (item);
XtVaSetValues (w, XmNuserData, node->Data (), NULL);
-
+
m_noStrings ++;
}
void wxChoice::Delete(int WXUNUSED(n))
{
wxFAIL_MSG( "Sorry, wxChoice::Delete isn't implemented yet. Maybe you'd like to volunteer? :-)" );
-
+
// What should we do -- remove the callback for this button widget,
// delete the m_stringList entry, delete the button widget, construct a new widget list
// (see Append)
-
+
// TODO
m_noStrings --;
}
XtVaGetValues (label,
XmNlabelString, &text,
NULL);
-
+
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
{
int i = 0;
else
i++;
} // for()
-
+
XmStringFree(text) ;
XtFree (s);
return -1;
void wxChoice::SetSelection(int n)
{
m_inSetValue = TRUE;
-
+
wxNode *node = m_stringList.Nth (n);
if (node)
{
Dimension selectionWidth, selectionHeight;
-
+
char *s = (char *) node->Data ();
XmString text = XmStringCreateSimple (s);
XtVaGetValues ((Widget) m_widgetList[n], XmNwidth, &selectionWidth, XmNheight, &selectionHeight, NULL);
void wxChoice::SetColumns(int n)
{
if (n<1) n = 1 ;
-
+
short numColumns = n ;
Arg args[3];
-
+
XtSetArg(args[0], XmNnumColumns, numColumns);
XtSetArg(args[1], XmNpacking, XmPACK_COLUMN);
XtSetValues((Widget) m_menuWidget,args,2) ;
int wxChoice::GetColumns(void) const
{
short numColumns ;
-
+
XtVaGetValues((Widget) m_menuWidget,XmNnumColumns,&numColumns,NULL) ;
return numColumns ;
}
{
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_ANY, NULL);
bool managed = XtIsManaged((Widget) m_formWidget);
-
+
if (managed)
XtUnmanageChild ((Widget) m_formWidget);
-
+
int actualWidth = width, actualHeight = height;
-
+
if (width > -1)
{
int i;
XtVaSetValues ((Widget) m_buttonWidget, XmNheight, actualHeight,
NULL);
}
-
+
if (managed)
XtManageChild ((Widget) m_formWidget);
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
-
+
wxControl::DoSetSize (x, y, width, height, sizeFlags);
}
{
if (item->InSetValue())
return;
-
+
char *s = NULL;
XtVaGetValues (w, XmNuserData, &s, NULL);
if (s)
{
int width, height, width1, height1;
GetSize(& width, & height);
-
+
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_mainWidget));
XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL);
XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);
-
+
/* TODO: why does this cause a crash in XtWidgetToApplicationContext?
int i;
for (i = 0; i < m_noStrings; i++)
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// m_backgroundColour = parent->GetBackgroundColour();
m_backgroundColour = * wxWHITE;
m_foregroundColour = parent->GetForegroundColour();
-
+
if (parent) parent->AddChild(this);
-
+
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
-
+
Widget parentWidget = (Widget) parent->GetClientWidget();
-
- Widget buttonWidget = XtVaCreateManagedWidget((char*) (const char*) name,
+
+ Widget buttonWidget = XtVaCreateManagedWidget(name.c_str(),
xmComboBoxWidgetClass, parentWidget,
XmNmarginHeight, 0,
XmNmarginWidth, 0,
XmNsorted, ((style & wxCB_SORT) == wxCB_SORT),
XmNstaticList, ((style & wxCB_SIMPLE) == wxCB_SIMPLE),
NULL);
-
+
XtAddCallback (buttonWidget, XmNselectionCallback, (XtCallbackProc) wxComboBoxCallback,
(XtPointer) this);
XtAddCallback (buttonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxComboBoxCallback,
(XtPointer) this);
-
+
int i;
for (i = 0; i < n; i++)
{
m_stringList.Add(choices[i]);
}
m_noStrings = n;
-
+
m_mainWidget = (Widget) buttonWidget;
-
+
XtManageChild (buttonWidget);
-
+
SetValue(value);
-
+
m_font = parent->GetFont();
ChangeFont(FALSE);
-
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
-
+
ChangeBackgroundColour();
-
+
return TRUE;
}
XmString text = XmStringCreateSimple ((char*) (const char*) s);
bool found = (XmComboBoxGetMatchPos((Widget) m_mainWidget,
text, &pos_list, &count) != 0);
-
+
XmStringFree(text);
-
+
if (found && count > 0)
{
int pos = pos_list[0] - 1;
free(pos_list);
return pos;
}
-
+
return -1;
}
void wxComboBox::Remove(long from, long to)
{
XmComboBoxSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
- (Time) 0);
+ (Time) 0);
XmComboBoxRemove ((Widget) m_mainWidget);
}
void wxComboBox::SetSelection(long from, long to)
{
XmComboBoxSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
- (Time) 0);
+ (Time) 0);
}
void wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
XmComboBoxSelectionCallbackStruct * cbs)
{
wxComboBox *item = (wxComboBox *) clientData;
-
+
switch (cbs->reason)
{
case XmCR_SINGLE_SELECT:
{
wxCommandEvent event (wxEVT_COMMAND_COMBOBOX_SELECTED, item->GetId());
event.m_commandInt = cbs->index - 1;
- // event.m_commandString = item->GetString (event.m_commandInt);
+ // event.m_commandString = item->GetString (event.m_commandInt);
event.m_extraLong = TRUE;
event.SetEventObject(item);
item->ProcessCommand (event);
{
wxCommandEvent event (wxEVT_COMMAND_TEXT_UPDATED, item->GetId());
event.m_commandInt = -1;
- // event.m_commandString = item->GetValue();
+ // event.m_commandString = item->GetValue();
event.m_extraLong = TRUE;
event.SetEventObject(item);
item->ProcessCommand (event);
{
m_backgroundColour = *wxWHITE;
m_foregroundColour = *wxBLACK;
+
+#if WXWIN_COMPATIBILITY
m_callback = 0;
+#endif // WXWIN_COMPATIBILITY
+
m_inSetValue = FALSE;
}
}
}
-void wxControl::ProcessCommand (wxCommandEvent & event)
+bool wxControl::ProcessCommand(wxCommandEvent & event)
{
- // Tries:
- // 1) A callback function (to become obsolete)
- // 2) OnCommand, starting at this window and working up parent hierarchy
- // 3) OnCommand then calls ProcessEvent to search the event tables.
- if (m_callback)
+#if WXWIN_COMPATIBILITY
+ if ( m_callback )
{
- (void) (*(m_callback)) (*this, event);
+ (void)(*m_callback)(this, event);
+
+ return TRUE;
}
else
- {
- GetEventHandler()->OnCommand(*this, event);
- }
-}
-
-void wxControl::Centre (int direction)
-{
- int x, y, width, height, panel_width, panel_height, new_x, new_y;
+#endif // WXWIN_COMPATIBILITY
- wxWindow *parent = (wxWindow *) GetParent ();
- if (!parent)
- return;
-
- parent->GetClientSize (&panel_width, &panel_height);
- GetSize (&width, &height);
- GetPosition (&x, &y);
-
- new_x = x;
- new_y = y;
-
- if (direction & wxHORIZONTAL)
- new_x = (int) ((panel_width - width) / 2);
-
- if (direction & wxVERTICAL)
- new_y = (int) ((panel_height - height) / 2);
-
- SetSize (new_x, new_y, width, height);
+ return GetEventHandler()->ProcessEvent(event);
}
-
wxList wxModelessWindows; // Frames and modeless dialogs
extern wxList wxPendingDelete;
-extern wxHashTable *wxWidgetHashTable;
-
#define wxUSE_INVISIBLE_RESIZE 1
#if !USE_SHARED_LIBRARY
#include "wx/motif/private.h"
-extern wxHashTable *wxWidgetHashTable;
-
void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
void wxFrameFocusProc(Widget workArea, XtPointer clientData,
XmAnyCallbackStruct *cbs);
int width = size.x; int height = size.y;
if (wxTopLevelUsed)
+ {
// Change suggested by Matthew Flatt
- m_frameShell = (WXWidget) XtAppCreateShell(name, wxTheApp->GetClassName(), topLevelShellWidgetClass, (Display*) wxGetDisplay(), NULL, 0);
+ m_frameShell = (WXWidget)XtAppCreateShell
+ (
+ name,
+ wxTheApp->GetClassName(),
+ topLevelShellWidgetClass,
+ (Display*) wxGetDisplay(),
+ NULL,
+ 0
+ );
+ }
else
{
m_frameShell = wxTheApp->GetTopLevelWidget();
// XmNresizePolicy, XmRESIZE_ANY,
NULL);
+ wxLogDebug("Created frame (0x%08x) with work area 0x%08x and client "
+ "area 0x%08x", m_frameWidget, m_workArea, m_clientArea);
+
XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE,
wxUniversalRepaintProc, (XtPointer) this);
XtManageChild((Widget) m_clientArea);
XtManageChild((Widget) m_workArea);
- wxASSERT_MSG( !wxGetWindowFromTable((Widget)m_workArea),
- "Widget table clash in frame.cpp") ;
-
wxAddWindowToTable((Widget) m_workArea, this);
XtTranslations ptr ;
* indirect or consequential damages or any damages
* whatsoever resulting from loss of use, data or profits,
* whether in an action of contract, negligence or other tortious
-* action, arising out of or in connection with the use
+* action, arising out of or in connection with the use
* or performance of this software.
*
*/
m_windowStyle = style;
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
-
+
if (parent) parent->AddChild(this);
-
+
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
-
+
Widget parentWidget = (Widget) parent->GetClientWidget();
-
+
Arg args[4];
int count = 4;
if (style & wxHORIZONTAL)
XtSetArg(args[3], XmNmaximum, range);
Widget gaugeWidget = XtCreateManagedWidget("gauge", xmGaugeWidgetClass, parentWidget, args, count);
m_mainWidget = (WXWidget) gaugeWidget ;
-
+
XtManageChild (gaugeWidget);
-
+
int x = pos.x; int y = pos.y;
int width = size.x; int height = size.y;
if (width == -1)
width = 150;
if (height == -1)
height = 80;
-
+
m_font = parent->GetFont();
ChangeFont(FALSE);
-
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
-
+
ChangeBackgroundColour();
-
+
return TRUE;
}
int empty;
} XmGaugeClassPart;
-typedef struct _XmGaugeClassRec {
+typedef struct _XmGaugeClassRec {
CoreClassPart core_class;
XmPrimitiveClassPart primitive_class;
XmGaugeClassPart gauge_class;
int maximum;
unsigned char orientation;
unsigned char processingDirection;
-
+
XtCallbackList dragCallback;
XtCallbackList valueChangedCallback;
-
+
/* private fields */
Boolean dragging; /* drag in progress ? */
int oldx, oldy;
void
GaugePick(Widget w, XEvent *e, String *args, Cardinal *num_args);
-void
+void
GaugeDrag(Widget w, XEvent *e, String *args, Cardinal *num_args);
-void
+void
GaugeDrop(Widget w, XEvent *e, String *args, Cardinal *num_args);
unsigned long backgr,foregr;
XRectangle rects[1];
***/
-
+
sht = gw->primitive.shadow_thickness;
-
+
ratio = (float)THIS.value/
(float)(THIS.maximum - THIS.minimum);
/***chubraev
len=strlen(string);
XtVaGetValues(gw,XmNbackground,&backgr,XmNforeground,&foregr,NULL);
***/
-
+
if(clear) {
XClearArea(XtDisplay(gw), XtWindow(gw), sht, sht,
gw->core.width - 2 * sht, gw->core.height - 2 * sht, False);
case XmHORIZONTAL:
size = (int) ((gw->core.width - 2 * sht)*ratio);
/***chubraev
- XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht+gw->core.width/2,
+ XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht+gw->core.width/2,
gw->core.height - 2 * sht, string, len);
***/
switch(THIS.processingDirection) {
case XmMAX_ON_BOTTOM:
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
sht, sht, size, gw->core.height - 2 * sht);
-
+
/***chubraev
rects[0].x = sht; rects[0].y = sht;
rects[0].width = size; rects[0].height = gw->core.height - 2 * sht;
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
gw->core.width - size - sht, sht,
size, gw->core.height - 2 * sht);
-
+
/***chubraev
rects[0].x = gw->core.width - size - sht; rects[0].y = sht;
rects[0].width = size; rects[0].height = gw->core.height - 2 * sht;
/***chubraev
XSetClipRectangles(XtDisplay(gw), THIS.gc, 0, 0, rects, 1, Unsorted);
XSetForeground(XtDisplay(gw), THIS.gc, backgr);
- XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht+gw->core.width/2,
+ XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht+gw->core.width/2,
gw->core.height - 2 * sht, string, len);
***/
-
+
break;
case XmVERTICAL:
size = (int) ((gw->core.height - 2 * sht)*ratio);
/***chubraev
- XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht,
+ XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht,
sht+gw->core.height/2, string,len);
***/
switch(THIS.processingDirection) {
case XmMAX_ON_BOTTOM:
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
sht, sht, gw->core.width - 2 * sht, size);
-
+
/***chubraev
rects[0].x = sht; rects[0].y = sht;
rects[0].width = gw->core.width - 2 * sht; rects[0].height = size;
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
sht, gw->core.height - size - sht,
gw->core.width - 2 * sht, size);
-
+
/***chubraev
rects[0].x = sht; rects[0].y = gw->core.height - size - sht;
rects[0].width = gw->core.width - 2 * sht; rects[0].height = size;
/***chubraev
XSetClipRectangles(XtDisplay(gw), THIS.gc, 0, 0, rects, 1, Unsorted);
XSetForeground(XtDisplay(gw), THIS.gc, backgr);
- XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht,
+ XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht,
sht+gw->core.height/2, string,len);
***/
break;
XSetClipMask(XtDisplay(gw), THIS.gc, None);
XSetForeground(XtDisplay(gw), THIS.gc, foregr);
***/
-#undef THIS
+#undef THIS
}
/* Old code
#define THIS gw->gauge
int size, sht;
/* float ratio; */
-
+
sht = gw->primitive.shadow_thickness;
/* See fix comment below: can cause divide by zero error.
ratio = (float)((float)THIS.maximum -
}
break;
}
-#undef THIS
+#undef THIS
}
#endif
XmGaugeWidget gw = (XmGaugeWidget)new_w;
#define THIS gw->gauge
XGCValues values;
-
+
values.foreground = gw->primitive.foreground;
THIS.gc = XtGetGC(new_w, GCForeground, &values);
-
-#undef THIS
-
+
+#undef THIS
+
}
XmGaugeWidget gw = (XmGaugeWidget)w;
#define THIS gw->gauge
XtReleaseGC(w, THIS.gc);
-#undef THIS
+#undef THIS
}
{
XmGaugeWidget cgw = (XmGaugeWidget)cw;
XmGaugeWidget ngw = (XmGaugeWidget)nw;
-
+
Boolean redraw = False;
if(cgw->primitive.foreground != ngw->primitive.foreground) {
XGCValues values;
-
+
redraw = True;
XtReleaseGC(nw, ngw->gauge.gc);
values.foreground = ngw->primitive.foreground;
XmGaugeWidget gw = (XmGaugeWidget)w;
#define THIS gw->gauge
int sht;
-
+
sht = gw->primitive.shadow_thickness;
_XmDrawShadows(XtDisplay(w), XtWindow(w),
gw->primitive.top_shadow_GC,
0, 0, w->core.width, w->core.height,
sht, XmSHADOW_IN);
DrawSlider(gw, False);
-#undef THIS
+#undef THIS
}
-static XtResource
+static XtResource
resources[] = {
#define offset(field) XtOffset(XmGaugeWidget, gauge.field)
{XmNvalue, XmCValue, XtRInt, sizeof(int),
offset(value), XtRImmediate, (caddr_t)10},
-
+
{XmNminimum, XmCValue, XtRInt, sizeof(int),
offset(minimum), XtRImmediate, (caddr_t)0},
-
+
{XmNmaximum, XmCValue, XtRInt, sizeof(int),
offset(maximum), XtRImmediate, (caddr_t)100},
-
+
{XmNorientation, XmCOrientation, XmROrientation, sizeof(unsigned char),
offset(orientation), XtRImmediate, (caddr_t)XmVERTICAL},
-
+
{XmNprocessingDirection, XmCProcessingDirection,
XmRProcessingDirection, sizeof(unsigned char),
offset(processingDirection), XtRImmediate, (caddr_t)XmMAX_ON_RIGHT},
-
+
{XmNdragCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList),
offset(dragCallback), XtRImmediate, (caddr_t)NULL},
-
+
{XmNvalueChangedCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList),
offset(valueChangedCallback), XtRImmediate, (caddr_t)NULL},
-
-
+
+
#undef offset
};
-void
+void
GaugePick(Widget w, XEvent *e, String *args, Cardinal *num_args)
{
/* Commented out for a read-only gauge in wxWindows */
Boolean dragging = False;
XButtonEvent *event = (XButtonEvent *)e;
int x, y;
-
+
x = event->x;
y = event->y;
sht = gw->primitive.shadow_thickness;
gw->primitive.bottom_shadow_GC,
0, 0, w->core.width, w->core.height,
sht, XmSHADOW_IN);
-
-
+
+
ratio = (float)((float)THIS.maximum -
- (float)THIS.minimum) / (float)THIS.value;
+ (float)THIS.minimum) / (float)THIS.value;
switch(THIS.orientation) {
case XmHORIZONTAL:
size = (w->core.width - 2 * sht) / ratio;
THIS.dragging = dragging;
THIS.oldx = x;
THIS.oldy = y;
-#undef THIS
+#undef THIS
#endif
}
#define round(x) ( (x) > 0 ? ((x) + 0.5) : -(-(x) + 0.5) )
-void
+void
GaugeDrag(Widget w, XEvent *e, String *args, Cardinal *num_args)
{
/* Commented out for a read-only gauge in wxWindows */
int sht, x, y, max, value;
float ratio, nratio, size, nsize, fvalue, delta;
XMotionEvent *event = (XMotionEvent *)e;
-
+
if( ! THIS.dragging) return;
-
+
x = event->x;
y = event->y;
sht = gw->primitive.shadow_thickness;
-
+
ratio = (float)THIS.value / (float)((float)THIS.maximum -
(float)THIS.minimum);
switch(THIS.orientation) {
if(nsize > (float)max) nsize = (float)max;
if(nsize < (float)0 ) nsize = (float)0;
nratio = nsize / (float)max;
-
+
fvalue = (int)((float)THIS.maximum -
(float)THIS.minimum) * (float)nsize / (float)max;
value = round(fvalue);
-
+
THIS.value = value;
THIS.oldx = x;
THIS.oldy = y;
-
+
/* clear old slider only if it was larger */
DrawSlider(gw, (nsize < size));
-
+
{
XmGaugeCallbackStruct call;
-
+
if(NULL != THIS.dragCallback) {
call.reason = XmCR_DRAG;
call.event = e;
XtCallCallbacks(w, XmNdragCallback, &call);
}
}
-#undef THIS
+#undef THIS
#endif
}
-void
+void
GaugeDrop(Widget w, XEvent *e, String *args, Cardinal *num_args)
{
/* Commented out for a read-only gauge in wxWindows */
XmGaugeWidget gw = (XmGaugeWidget)w;
#define THIS gw->gauge
if( ! THIS.dragging) return;
-
+
if(NULL != THIS.valueChangedCallback) {
XmGaugeCallbackStruct call;
call.reason = XmCR_VALUE_CHANGED;
XtCallCallbacks(w, XmNvalueChangedCallback, &call);
}
THIS.dragging = False;
-#undef THIS
+#undef THIS
#endif
}
XmGaugeSetValue(Widget w, int value)
{
XmGaugeWidget gw = (XmGaugeWidget)w;
-
+
gw->gauge.value = value;
DrawSlider(gw, True);
XFlush(XtDisplay(w));
int
XmGaugeGetValue(Widget w)
-{
+{
XmGaugeWidget gw = (XmGaugeWidget)w;
-
+
return gw->gauge.value;
}
wxString title(m_titles[i]);
menu->SetButtonWidget(menu->CreateMenu (this, menuBarW, menu, title, TRUE));
- wxStripMenuCodes ((char*) (const char*) title, wxBuffer);
-
- if (strcmp (wxBuffer, "Help") == 0)
+ if (strcmp (wxStripMenuCodes(title), "Help") == 0)
XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL);
// tear off menu support
menu = XmCreatePulldownMenu ((Widget) parent, "pulldown", args, 2);
- XmString label_str = XmStringCreateSimple (wxBuffer);
- buttonWidget = XtVaCreateManagedWidget (wxBuffer,
+ wxString title2(wxStripMenuCodes(title));
+ wxXmString label_str(title2);
+ buttonWidget = XtVaCreateManagedWidget(title2,
#if wxUSE_GADGETS
xmCascadeButtonGadgetClass, (Widget) parent,
#else
if (mnem != 0)
XtVaSetValues (buttonWidget, XmNmnemonic, mnem, NULL);
-
- XmStringFree (label_str);
}
m_menuWidget = (WXWidget) menu;
m_strName(strName)
{
wxASSERT( pParentMenu != NULL );
-
+
m_pParentMenu = pParentMenu;
m_pSubMenu = pSubMenu;
m_idItem = id;
m_bEnabled = TRUE;
m_bChecked = FALSE;
-
+
//// Motif-specific
m_menuBar = NULL;
m_buttonWidget = (WXWidget) NULL;
m_topMenu = NULL;
}
-wxMenuItem::~wxMenuItem()
+wxMenuItem::~wxMenuItem()
{
}
void wxMenuItem::DeleteSubMenu()
{
wxASSERT( m_pSubMenu != NULL );
-
+
delete m_pSubMenu;
m_pSubMenu = NULL;
}
if (m_buttonWidget)
XtSetSensitive( (Widget) m_buttonWidget, (Boolean) bDoEnable);
}
-
+
m_bEnabled = bDoEnable;
}
}
void wxMenuItem::Check(bool bDoCheck)
{
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
-
+
if ( m_bChecked != bDoCheck )
{
if (m_buttonWidget && XtIsSubclass ((Widget) m_buttonWidget, xmToggleButtonGadgetClass))
{
m_menuBar = menuBar;
m_topMenu = topMenu;
-
+
if (GetId() == -2)
{
// Id=-2 identifies a Title item.
- wxStripMenuCodes ((char*) (const char*) m_strName, wxBuffer);
- m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (wxBuffer,
+ m_buttonWidget = (WXWidget) XtVaCreateManagedWidget
+ (wxStripMenuCodes(m_strName),
xmLabelGadgetClass, (Widget) menu, NULL);
}
else if ((!m_strName.IsNull() && m_strName != "") && (!m_pSubMenu))
{
- wxStripMenuCodes ((char*) (const char*) m_strName, wxBuffer);
+ wxString strName = wxStripMenuCodes(m_strName);
if (IsCheckable())
{
- m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (wxBuffer,
+ m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (strName,
xmToggleButtonGadgetClass, (Widget) menu,
NULL);
XtVaSetValues ((Widget) m_buttonWidget, XmNset, (Boolean) IsChecked(), NULL);
}
else
- m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (wxBuffer,
+ m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (strName,
xmPushButtonGadgetClass, (Widget) menu,
NULL);
char mnem = wxFindMnemonic (m_strName);
if (mnem != 0)
XtVaSetValues ((Widget) m_buttonWidget, XmNmnemonic, mnem, NULL);
-
+
//// TODO: proper accelerator treatment. What does wxFindAccelerator
//// look for?
- strcpy(wxBuffer, (char*) (const char*) m_strName);
- char *accel = wxFindAccelerator (wxBuffer);
+ strName = m_strName;
+ char *accel = wxFindAccelerator (strName);
if (accel)
XtVaSetValues ((Widget) m_buttonWidget, XmNaccelerator, accel, NULL);
-
+
// TODO: What does this do?
- strcpy(wxBuffer, (char*) (const char*) m_strName);
- XmString accel_str = wxFindAcceleratorText (wxBuffer);
+ XmString accel_str = wxFindAcceleratorText (strName);
if (accel_str)
{
XtVaSetValues ((Widget) m_buttonWidget, XmNacceleratorText, accel_str, NULL);
XmStringFree (accel_str);
}
-
+
if (IsCheckable())
XtAddCallback ((Widget) m_buttonWidget,
XmNvalueChangedCallback,
if (GetId() == -2)
{
; // Nothing
-
+
}
else if ((!m_strName.IsNull() && (m_strName != "")) && !m_pSubMenu)
{
else if (GetId() == -1)
{
; // Nothing
-
+
}
else if (GetSubMenu())
{
if (full)
m_buttonWidget = NULL;
}
-
+
if (m_buttonWidget && full)
{
XtDestroyWidget ((Widget) m_buttonWidget);
void wxMenuItem::SetLabel(const wxString& label)
{
char mnem = wxFindMnemonic (label);
- wxStripMenuCodes ((char*) (const char*) label, wxBuffer);
-
+ wxString label2 = wxStripMenuCodes(label);
+
m_strName = label;
-
+
if (m_buttonWidget)
{
- XmString label_str = XmStringCreateSimple (wxBuffer);
+ wxXmString label_str(label2);
XtVaSetValues ((Widget) m_buttonWidget,
XmNlabelString, label_str,
NULL);
- XmStringFree (label_str);
if (mnem != 0)
XtVaSetValues ((Widget) m_buttonWidget, XmNmnemonic, mnem, NULL);
- strcpy(wxBuffer, (char*) (const char*) label);
- char *accel = wxFindAccelerator (wxBuffer);
+ char *accel = wxFindAccelerator (label2);
if (accel)
XtVaSetValues ((Widget) m_buttonWidget, XmNaccelerator, accel, NULL);
-
- strcpy(wxBuffer, (char*) (const char*) label);
- XmString accel_str = wxFindAcceleratorText (wxBuffer);
+
+ XmString accel_str = wxFindAcceleratorText (label2);
if (accel_str)
{
XtVaSetValues ((Widget) m_buttonWidget, XmNacceleratorText, accel_str, NULL);
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item->GetId());
commandEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
commandEvent.SetInt( item->GetId() );
-
+
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(commandEvent);
}
else if (item->GetTopMenu())
wxCommandEvent event (wxEVT_COMMAND_MENU_SELECTED, item->GetId());
event.SetEventObject(item->GetTopMenu());
event.SetInt( item->GetId() );
-
+
item->GetTopMenu()->ProcessCommand (event);
}
}
{
wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, item->GetId());
menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
-
+
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(menuEvent);
}
}
}
-void
+void
wxMenuItemDisarmCallback (Widget w, XtPointer clientData,
XtPointer ptr)
{
// special to event system
wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, -1);
menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
-
+
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(menuEvent);
}
}
wxString label1(wxStripMenuCodes(title));
- XmString text = XmStringCreateSimple ((char*) (const char*) label1);
+ wxXmString text(label1.c_str());
- Widget formWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
+ Widget formWidget = XtVaCreateManagedWidget (name.c_str(),
xmFormWidgetClass, parentWidget,
XmNmarginHeight, 0,
XmNmarginWidth, 0,
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
if (label1 != "")
{
- text = XmStringCreateSimple ((char*) (const char*) label1);
- Widget labelWidget = XtVaCreateManagedWidget ((char*) (const char*) label1,
+ wxXmString text(label1);
+ (void)XtVaCreateManagedWidget(label1.c_str(),
#if wxUSE_GADGETS
- style & wxCOLOURED ?
- xmLabelWidgetClass : xmLabelGadgetClass,
+ style & wxCOLOURED ? xmLabelWidgetClass
+ : xmLabelGadgetClass,
formWidget,
#else
xmLabelWidgetClass, formWidget,
XmNfontList, fontList,
XmNlabelString, text,
NULL);
-
- XmStringFree (text);
}
Widget frameWidget = XtVaCreateManagedWidget ("frame",
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_font = parent->GetFont();
-
+
if (parent) parent->AddChild(this);
-
+
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
-
+
m_windowStyle = style ;
-
+
Widget parentWidget = (Widget) parent->GetClientWidget();
-
+
wxString label1(wxStripMenuCodes(label));
-
+
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
-
+
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
-
+
Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle",
#if wxUSE_GADGETS
xmToggleButtonGadgetClass, parentWidget,
XmNindicatorType, XmONE_OF_MANY, // diamond-shape
NULL);
XmStringFree (text);
-
+
XtAddCallback (radioButtonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxRadioButtonCallback,
(XtCallbackProc) this);
-
+
m_mainWidget = (WXWidget) radioButtonWidget;
-
+
XtManageChild (radioButtonWidget);
-
+
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
-
+
ChangeBackgroundColour();
-
+
return TRUE;
}
{
if (!cbs->set)
return;
-
+
wxRadioButton *item = (wxRadioButton *) clientData;
if (item->InSetValue())
return;
-
+
wxCommandEvent event (wxEVT_COMMAND_RADIOBUTTON_SELECTED, item->GetId());
event.SetEventObject(item);
-
+
item->ProcessCommand (event);
}
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
SetValidator(validator);
-
+
m_windowStyle = style;
if ( id == -1 )
- m_windowId = (int)NewControlId();
+ m_windowId = (int)NewControlId();
else
- m_windowId = id;
+ m_windowId = id;
int x = pos.x;
int y = pos.y;
SetValidator(validator);
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
-
+
if (parent) parent->AddChild(this);
-
+
m_lineSize = 1;
m_windowStyle = style;
m_tickFreq = 0;
-
+
if ( id == -1 )
m_windowId = (int)NewControlId();
else
m_windowId = id;
-
+
m_rangeMax = maxValue;
m_rangeMin = minValue;
-
+
// Not used in Motif, I think
m_pageSize = (int)((maxValue-minValue)/10);
-
+
Widget parentWidget = (Widget) parent->GetClientWidget();
-
+
Widget sliderWidget = XtVaCreateManagedWidget ("sliderWidget",
xmScaleWidgetClass, parentWidget,
XmNorientation,
XmNvalue, value,
XmNshowValue, True,
NULL);
-
+
m_mainWidget = (WXWidget) sliderWidget;
-
+
if(style & wxSL_NOTIFY_DRAG)
XtAddCallback (sliderWidget, XmNdragCallback,
(XtCallbackProc) wxSliderCallback, (XtPointer) this);
else
XtAddCallback (sliderWidget, XmNvalueChangedCallback,
(XtCallbackProc) wxSliderCallback, (XtPointer) this);
-
+
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
-
+
m_font = parent->GetFont();
-
+
ChangeFont(FALSE);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
-
+
ChangeBackgroundColour();
-
+
return TRUE;
}
void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
Widget widget = (Widget) m_mainWidget;
-
+
bool managed = XtIsManaged(widget);
-
+
if (managed)
XtUnmanageChild (widget);
-
+
if (((m_windowStyle & wxHORIZONTAL) == wxHORIZONTAL) && (width > -1))
{
XtVaSetValues (widget, XmNscaleWidth, wxMax (width, 10), NULL);
}
-
+
if (((m_windowStyle & wxVERTICAL) == wxVERTICAL) && (height > -1))
{
XtVaSetValues (widget, XmNscaleHeight, wxMax (height, 10), NULL);
}
-
+
int xx = x; int yy = y;
AdjustForParentClientOrigin(xx, yy, sizeFlags);
-
+
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
XtVaSetValues (widget, XmNx, xx, NULL);
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
XtVaSetValues (widget, XmNy, yy, NULL);
-
+
if (managed)
XtManageChild (widget);
}
{
m_rangeMin = minValue;
m_rangeMax = maxValue;
-
+
XtVaSetValues ((Widget) m_mainWidget, XmNminimum, minValue, XmNmaximum, maxValue, NULL);
}
// TODO: the XmCR_VALUE_CHANGED case should be handled
// differently (it's not sent continually as the slider moves).
// In which case we need a similar behaviour for other platforms.
-
+
wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, slider->GetId());
XtVaGetValues (widget, XmNvalue, &event.m_commandInt, NULL);
event.SetEventObject(slider);
slider->ProcessCommand(event);
-
+
// Also send a wxCommandEvent for compatibility.
wxCommandEvent event2(wxEVT_COMMAND_SLIDER_UPDATED, slider->GetId());
event2.SetEventObject(slider);
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
#endif
-wxSpinButton::wxSpinButton()
-{
- m_min = 0;
- m_max = 100;
-}
-
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
{
m_windowStyle = style;
if (parent) parent->AddChild(this);
-
- m_min = 0;
- m_max = 100;
+
+ InitBase();
m_windowId = (id == -1) ? NewControlId() : id;
int wxSpinButton::GetValue() const
{
- // TODO
+ // TODO
return 0;
}
void wxSpinButton::SetValue(int val)
{
- // TODO
+ // TODO
}
void wxSpinButton::SetRange(int minVal, int maxVal)
{
- m_min = minVal;
- m_max = maxVal;
- // TODO
+ // TODO
+ wxSpinButtonBase::SetRange(minVal, maxVal);
}
void wxSpinButton::ChangeFont(bool keepOriginalSize)
{
// TODO
}
-
-// Spin event
-IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
-
-wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
- wxScrollEvent(commandType, id)
-{
-}
-
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
if (parent) parent->AddChild(this);
if ( id == -1 )
- m_windowId = (int)NewControlId();
+ m_windowId = (int)NewControlId();
else
- m_windowId = id;
+ m_windowId = id;
m_windowStyle = style;
XtVaSetValues (widget,
XmNlabelPixmap, ((wxBitmap&)bitmap).GetLabelPixmap (widget),
XmNlabelType, XmPIXMAP,
- NULL);
+ NULL);
GetSize(&w1, &h1);
if (! (w1 == w2) && (h1 == h2))
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
-// EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
+//EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
END_EVENT_TABLE()
#endif
/*
* Static box
*/
-
+
wxStaticBox::wxStaticBox()
{
m_formWidget = (WXWidget) 0;
if (parent) parent->AddChild(this);
if ( id == -1 )
- m_windowId = (int)NewControlId();
+ m_windowId = (int)NewControlId();
else
- m_windowId = id;
+ m_windowId = id;
m_windowStyle = style;
Widget parentWidget = (Widget) parent->GetClientWidget();
Widget formWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
- xmFormWidgetClass, parentWidget,
- XmNmarginHeight, 0,
- XmNmarginWidth, 0,
- NULL);
+ xmFormWidgetClass, parentWidget,
+ XmNmarginHeight, 0,
+ XmNmarginWidth, 0,
+ NULL);
if (hasLabel)
wxString label1(wxStripMenuCodes(label));
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
m_labelWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) label1,
- xmLabelWidgetClass, formWidget,
- XmNfontList, fontList,
- XmNlabelString, text,
- NULL);
+ xmLabelWidgetClass, formWidget,
+ XmNfontList, fontList,
+ XmNlabelString, text,
+ NULL);
XmStringFree (text);
}
Widget frameWidget = XtVaCreateManagedWidget ("frame",
- xmFrameWidgetClass, formWidget,
- XmNshadowType, XmSHADOW_IN,
-// XmNmarginHeight, 0,
-// XmNmarginWidth, 0,
- NULL);
+ xmFrameWidgetClass, formWidget,
+ XmNshadowType, XmSHADOW_IN,
+ //XmNmarginHeight, 0,
+ //XmNmarginWidth, 0,
+ NULL);
if (hasLabel)
XtVaSetValues ((Widget) m_labelWidget,
- XmNtopAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_FORM,
- XmNrightAttachment, XmATTACH_FORM,
- XmNalignment, XmALIGNMENT_BEGINNING,
- NULL);
+ XmNtopAttachment, XmATTACH_FORM,
+ XmNleftAttachment, XmATTACH_FORM,
+ XmNrightAttachment, XmATTACH_FORM,
+ XmNalignment, XmALIGNMENT_BEGINNING,
+ NULL);
XtVaSetValues (frameWidget,
- XmNtopAttachment, hasLabel ? XmATTACH_WIDGET : XmATTACH_FORM,
- XmNtopWidget, hasLabel ? (Widget) m_labelWidget : formWidget,
- XmNbottomAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_FORM,
- XmNrightAttachment, XmATTACH_FORM,
- NULL);
+ XmNtopAttachment, hasLabel ? XmATTACH_WIDGET : XmATTACH_FORM,
+ XmNtopWidget, hasLabel ? (Widget) m_labelWidget : formWidget,
+ XmNbottomAttachment, XmATTACH_FORM,
+ XmNleftAttachment, XmATTACH_FORM,
+ XmNrightAttachment, XmATTACH_FORM,
+ NULL);
m_mainWidget = (WXWidget) frameWidget;
m_formWidget = (WXWidget) formWidget;
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
XtVaSetValues ((Widget) m_labelWidget,
- XmNlabelString, text,
- XmNlabelType, XmSTRING,
- NULL);
+ XmNlabelString, text,
+ XmNlabelType, XmSTRING,
+ NULL);
XmStringFree (text);
}
}
XmString text = 0;
char *s;
XtVaGetValues ((Widget) m_labelWidget,
- XmNlabelString, &text,
- NULL);
+ XmNlabelString, &text,
+ NULL);
if (!text)
return wxEmptyString;
if (width > -1)
XtVaSetValues ((Widget) m_mainWidget, XmNwidth, width,
- NULL);
+ NULL);
if (height > -1)
XtVaSetValues ((Widget) m_mainWidget, XmNheight, height - yy,
- NULL);
+ NULL);
}
}
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
m_foregroundColour = parent->GetForegroundColour();
if ( id == -1 )
- m_windowId = (int)NewControlId();
+ m_windowId = (int)NewControlId();
else
- m_windowId = id;
+ m_windowId = id;
m_windowStyle = style;
m_font = parent->GetFont();
// Text item
wxTextCtrl::wxTextCtrl()
-#ifndef NO_TEXT_WINDOW_STREAM
- : streambuf()
-#endif
{
m_tempCallbackStruct = (void*) NULL;
m_modified = FALSE;
}
}
-// The streambuf code was partly taken from chapter 3 by Jerry Schwarz of
-// AT&T's "C++ Lanuage System Release 3.0 Library Manual" - Stein Somers
-
-//=========================================================================
-// Called then the buffer is full (gcc 2.6.3)
-// or when "endl" is output (Borland 4.5)
-//=========================================================================
-// Class declaration using multiple inheritance doesn't work properly for
-// Borland. See note in wb_text.h.
-#ifndef NO_TEXT_WINDOW_STREAM
-int wxTextCtrl::overflow(int c)
-{
- // Make sure there is a holding area
- if ( allocate()==EOF )
- {
- wxError("Streambuf allocation failed","Internal error");
- return EOF;
- }
-
- // Verify that there are no characters in get area
- if ( gptr() && gptr() < egptr() )
- {
- wxError("wxTextCtrl::overflow: Who's trespassing my get area?","Internal error");
- return EOF;
- }
-
- // Reset get area
- setg(0,0,0);
-
- // Make sure there is a put area
- if ( ! pptr() )
- {
- /* This doesn't seem to be fatal so comment out error message */
- // wxError("Put area not opened","Internal error");
- setp( base(), base() );
- }
-
- // Determine how many characters have been inserted but no consumed
- int plen = pptr() - pbase();
-
- // Now Jerry relies on the fact that the buffer is at least 2 chars
- // long, but the holding area "may be as small as 1" ???
- // And we need an additional \0, so let's keep this inefficient but
- // safe copy.
-
- // If c!=EOF, it is a character that must also be comsumed
- int xtra = c==EOF? 0 : 1;
-
- // Write temporary C-string to wxTextWindow
- {
- char *txt = new char[plen+xtra+1];
- memcpy(txt, pbase(), plen);
- txt[plen] = (char)c; // append c
- txt[plen+xtra] = '\0'; // append '\0' or overwrite c
- // If the put area already contained \0, output will be truncated there
- WriteText(txt);
- delete[] txt;
- }
-
- // Reset put area
- setp(pbase(), epptr());
-
-#if defined(__WATCOMC__)
- return __NOT_EOF;
-#elif defined(zapeof) // HP-UX (all cfront based?)
- return zapeof(c);
-#else
- return c!=EOF ? c : 0; // this should make everybody happy
-#endif
-}
-
-//=========================================================================
-// called then "endl" is output (gcc) or then explicit sync is done (Borland)
-//=========================================================================
-int wxTextCtrl::sync()
-{
- // Verify that there are no characters in get area
- if ( gptr() && gptr() < egptr() )
- {
- wxError("Who's trespassing my get area?","Internal error");
- return EOF;
- }
-
- if ( pptr() && pptr() > pbase() ) return overflow(EOF);
-
- return 0;
- /* OLD CODE
- int len = pptr() - pbase();
- char *txt = new char[len+1];
- strncpy(txt, pbase(), len);
- txt[len] = '\0';
- (*this) << txt;
- setp(pbase(), epptr());
- delete[] txt;
- return 0;
- */
-}
-
-//=========================================================================
-// Should not be called by a "ostream". Used by a "istream"
-//=========================================================================
-int wxTextCtrl::underflow()
-{
- return EOF;
-}
-#endif
-
-wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
-{
- AppendText(s);
- return *this;
-}
-
-wxTextCtrl& wxTextCtrl::operator<<(float f)
-{
- wxString str;
- str.Printf("%.2f", f);
- AppendText(str);
- return *this;
-}
-
-wxTextCtrl& wxTextCtrl::operator<<(double d)
-{
- wxString str;
- str.Printf("%.2f", d);
- AppendText(str);
- return *this;
-}
-
-wxTextCtrl& wxTextCtrl::operator<<(int i)
-{
- wxString str;
- str.Printf("%d", i);
- AppendText(str);
- return *this;
-}
-
-wxTextCtrl& wxTextCtrl::operator<<(long i)
-{
- wxString str;
- str.Printf("%ld", i);
- AppendText(str);
- return *this;
-}
-
-wxTextCtrl& wxTextCtrl::operator<<(const char c)
-{
- char buf[2];
-
- buf[0] = c;
- buf[1] = 0;
- AppendText(buf);
- return *this;
-}
-
void wxTextCtrl::OnChar(wxKeyEvent& event)
{
// Indicates that we should generate a normal command, because
return mnem;
}
-char * wxFindAccelerator (char *s)
+char * wxFindAccelerator (const char *s)
{
// The accelerator text is after the \t char.
while (*s && *s != '\t')
wxBuffer[0] = '\0';
char *tmp = copystring (s);
s = tmp;
- char *p = s;
+ char *p = tmp;
while (1)
{
strcat (wxBuffer, s);
else
strcat (wxBuffer, "Meta");
- s = p + 1;
- p = s;
+ s = p++;
}
else
{
return wxBuffer;
}
-XmString wxFindAcceleratorText (char *s)
+XmString wxFindAcceleratorText (const char *s)
{
// The accelerator text is after the \t char.
while (*s && *s != '\t')
if (*s == '\0')
return (NULL);
s++;
- XmString text = XmStringCreateSimple (s);
+ XmString text = XmStringCreateSimple ((char *)s);
return text;
}
wxWidgetHashTable->Put((long) w, win);
+ wxLogDebug("Widget 0x%08x <-> window %p (%s)",
+ w, win, win->GetClassInfo()->GetClassName());
+
return TRUE;
}
dcpsg.cpp \
gridg.cpp \
laywin.cpp \
+ numdlgg.cpp \
panelg.cpp \
progdlgg.cpp \
prop.cpp \
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
+ IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
#endif
-wxSpinButton::wxSpinButton()
-{
- m_min = 0;
- m_max = 100;
-}
-
-bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
- long style, const wxString& name)
+bool wxSpinButton::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
{
wxSystemSettings settings;
m_backgroundColour = parent->GetBackgroundColour() ;
if (y < 0)
y = 0;
- m_min = 0;
- m_max = 100;
+ InitBase();
m_windowId = (id == -1) ? NewControlId() : id;
DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
-
+
if ( m_windowStyle & wxSP_HORIZONTAL )
wstyle |= UDS_HORZ;
if ( m_windowStyle & wxSP_ARROW_KEYS )
// TODO: have this for all controls.
if ( !m_hWnd )
return FALSE;
-
+
SubclassWin((WXHWND) m_hWnd);
return TRUE;
void wxSpinButton::SetRange(int minVal, int maxVal)
{
- m_min = minVal;
- m_max = maxVal;
+ wxSpinButtonBase::SetRange(minVal, maxVal);
::SendMessage(GetHwnd(), UDM_SETRANGE, 0,
(LPARAM) MAKELONG((short)maxVal, (short)minVal));
}
return FALSE;
}
-// Spin event
-IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
-
-wxSpinEvent::wxSpinEvent(wxEventType commandType, int id)
- : wxScrollEvent(commandType, id)
-{
-}
-
#endif // __WIN95__