1. more wxMotif fixes
2. wxGetNumberFromUser added 3. more compilation fixes when compiling without sockets git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3107 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -47,6 +47,7 @@ scrolwin.cpp G
|
||||
splitter.cpp G
|
||||
statusbr.cpp G
|
||||
tabg.cpp G
|
||||
numdlgg.cpp G
|
||||
textdlgg.cpp G
|
||||
tipdlg.cpp G
|
||||
treectrl.cpp G 16
|
||||
|
@@ -1307,11 +1307,10 @@ public:
|
||||
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
|
||||
|
@@ -53,7 +53,7 @@ private:
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// functions to get a string or a number from user
|
||||
// function to get a string from user
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxString WXDLLEXPORT
|
||||
@@ -65,15 +65,5 @@ wxGetTextFromUser(const wxString& message,
|
||||
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__
|
||||
|
@@ -61,7 +61,7 @@ enum {
|
||||
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;
|
||||
|
@@ -15,49 +15,35 @@
|
||||
#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,
|
||||
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" );
|
||||
|
||||
int GetValue() const;
|
||||
void SetValue( int value );
|
||||
void SetRange( int minVal, int maxVal );
|
||||
int GetMin() const;
|
||||
int GetMax() const;
|
||||
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 );
|
||||
@@ -66,38 +52,9 @@ public:
|
||||
GtkAdjustment *m_adjust;
|
||||
float m_oldPos;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxSpinEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class 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
|
||||
|
||||
#endif
|
||||
// __GTKSPINBUTTH__
|
||||
|
@@ -15,49 +15,35 @@
|
||||
#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,
|
||||
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" );
|
||||
|
||||
int GetValue() const;
|
||||
void SetValue( int value );
|
||||
void SetRange( int minVal, int maxVal );
|
||||
int GetMin() const;
|
||||
int GetMax() const;
|
||||
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 );
|
||||
@@ -66,38 +52,9 @@ public:
|
||||
GtkAdjustment *m_adjust;
|
||||
float m_oldPos;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxSpinEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class 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
|
||||
|
||||
#endif
|
||||
// __GTKSPINBUTTH__
|
||||
|
@@ -25,9 +25,12 @@ WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr;
|
||||
class WXDLLEXPORT wxButton: public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||
|
||||
public:
|
||||
inline wxButton() {}
|
||||
inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
wxButton() { }
|
||||
wxButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
|
@@ -29,22 +29,28 @@ public:
|
||||
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
|
||||
|
@@ -39,9 +39,15 @@ extern void wxDeleteWindowFromTable(Widget w);
|
||||
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);
|
||||
|
||||
|
@@ -16,55 +16,43 @@
|
||||
#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() { }
|
||||
|
||||
wxSpinButton();
|
||||
|
||||
inline wxSpinButton(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_VERTICAL, const wxString& name = "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");
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_VERTICAL,
|
||||
const wxString& name = "wxSpinButton");
|
||||
|
||||
|
||||
// Attributes
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// 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);
|
||||
inline int GetMin() const { return m_min; }
|
||||
inline int GetMax() const { return m_max; }
|
||||
|
||||
// Operations
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||
|
||||
// Implementation
|
||||
virtual void Command(wxCommandEvent& event) { (void)ProcessCommand(event); };
|
||||
virtual void ChangeFont(bool keepOriginalSize = TRUE);
|
||||
virtual void ChangeBackgroundColour();
|
||||
virtual void ChangeForegroundColour();
|
||||
@@ -74,29 +62,5 @@ protected:
|
||||
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_SPINBUTT_H_
|
||||
|
@@ -47,8 +47,10 @@ public:
|
||||
|
||||
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; }
|
||||
|
||||
|
@@ -45,8 +45,10 @@ public:
|
||||
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;
|
||||
|
@@ -23,10 +23,11 @@ WXDLLEXPORT_DATA(extern const char*) wxStaticTextNameStr;
|
||||
class WXDLLEXPORT wxStaticText: public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
||||
public:
|
||||
inline wxStaticText() { }
|
||||
|
||||
inline wxStaticText(wxWindow *parent, wxWindowID id,
|
||||
public:
|
||||
wxStaticText() { }
|
||||
|
||||
wxStaticText(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
@@ -43,11 +44,15 @@ class WXDLLEXPORT wxStaticText: public wxControl
|
||||
long style = 0,
|
||||
const wxString& name = wxStaticTextNameStr);
|
||||
|
||||
// operations
|
||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
|
||||
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
// operations
|
||||
virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Implementation
|
||||
virtual void ChangeFont(bool keepOriginalSize = TRUE);
|
||||
virtual void ChangeBackgroundColour();
|
||||
virtual void ChangeForegroundColour();
|
||||
|
@@ -16,22 +16,11 @@
|
||||
#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
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
|
||||
|
||||
@@ -47,9 +36,6 @@ public:
|
||||
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);
|
||||
}
|
||||
@@ -101,20 +87,6 @@ public:
|
||||
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);
|
||||
|
@@ -21,17 +21,8 @@
|
||||
|
||||
#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)
|
||||
|
||||
@@ -64,49 +55,16 @@ public:
|
||||
// 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
|
||||
|
@@ -1,6 +1,74 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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"
|
||||
#elif defined(__WXMOTIF__)
|
||||
@@ -15,5 +83,37 @@
|
||||
#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_
|
||||
|
@@ -7,5 +7,19 @@
|
||||
#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_
|
||||
|
@@ -159,6 +159,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
// ... 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);
|
||||
|
@@ -281,10 +281,10 @@ bool wxDocument::OnSaveDocument(const wxString& file)
|
||||
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
|
||||
{
|
||||
@@ -317,10 +317,10 @@ bool wxDocument::OnOpenDocument(const wxString& file)
|
||||
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
|
||||
{
|
||||
|
@@ -16,6 +16,13 @@
|
||||
#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"
|
||||
|
@@ -29,6 +29,11 @@ limitation)
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if !wxUSE_SOCKETS
|
||||
#undef wxUSE_FS_INET
|
||||
#define wxUSE_FS_INET 0
|
||||
#endif
|
||||
|
||||
#if wxUSE_FS_INET
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
|
@@ -17,6 +17,11 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if !wxUSE_SOCKETS
|
||||
#undef wxUSE_FS_ZIP
|
||||
#define wxUSE_FS_ZIP 0
|
||||
#endif
|
||||
|
||||
#if wxUSE_FS_ZIP
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
|
@@ -87,7 +87,9 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
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);
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_HELP
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/setup.h"
|
||||
#include "wx/string.h"
|
||||
@@ -122,4 +124,5 @@ wxExtHelpController::DisplayHelp(wxString const &relativeURL)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // wxUSE_HELP
|
||||
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_HELP
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/setup.h"
|
||||
#include "wx/string.h"
|
||||
@@ -320,3 +322,4 @@ wxHTMLHelpControllerBase::OnQuit()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // wxUSE_HELP
|
||||
|
208
src/generic/numdlgg.cpp
Normal file
208
src/generic/numdlgg.cpp
Normal file
@@ -0,0 +1,208 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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();
|
||||
}
|
@@ -45,35 +45,6 @@
|
||||
|
||||
#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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -89,11 +60,6 @@ static const int wxID_TEXT = 3000;
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#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()
|
||||
@@ -168,129 +134,3 @@ void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
|
||||
|
||||
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();
|
||||
}
|
||||
|
@@ -127,6 +127,7 @@ libwx_gtk_la_SOURCES = \
|
||||
imaglist.cpp \
|
||||
laywin.cpp \
|
||||
listctrl.cpp \
|
||||
numdlgg.cpp \
|
||||
panelg.cpp \
|
||||
printps.cpp \
|
||||
prntdlgg.cpp \
|
||||
|
@@ -360,8 +360,6 @@ int wxComboBox::GetSelection() const
|
||||
}
|
||||
}
|
||||
|
||||
wxFAIL_MSG( _T("wxComboBox: no selection") );
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -21,15 +21,18 @@
|
||||
|
||||
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 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -78,17 +78,18 @@ static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *wi
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
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;
|
||||
|
||||
@@ -201,15 +202,4 @@ void wxSpinButton::ApplyWidgetStyle()
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxSpinEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
||||
|
||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
|
||||
wxScrollEvent(commandType, id)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
@@ -127,6 +127,7 @@ libwx_gtk_la_SOURCES = \
|
||||
imaglist.cpp \
|
||||
laywin.cpp \
|
||||
listctrl.cpp \
|
||||
numdlgg.cpp \
|
||||
panelg.cpp \
|
||||
printps.cpp \
|
||||
prntdlgg.cpp \
|
||||
|
@@ -360,8 +360,6 @@ int wxComboBox::GetSelection() const
|
||||
}
|
||||
}
|
||||
|
||||
wxFAIL_MSG( _T("wxComboBox: no selection") );
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -21,15 +21,18 @@
|
||||
|
||||
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 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -78,17 +78,18 @@ static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *wi
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
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;
|
||||
|
||||
@@ -201,15 +202,4 @@ void wxSpinButton::ApplyWidgetStyle()
|
||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxSpinEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
||||
|
||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
|
||||
wxScrollEvent(commandType, id)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
@@ -61,6 +61,7 @@ libwx_motif_la_SOURCES = \
|
||||
docview.cpp \
|
||||
dynlib.cpp \
|
||||
event.cpp \
|
||||
ffile.cpp \
|
||||
file.cpp \
|
||||
fileconf.cpp \
|
||||
filesys.cpp \
|
||||
@@ -99,6 +100,7 @@ libwx_motif_la_SOURCES = \
|
||||
stream.cpp \
|
||||
tbarbase.cpp \
|
||||
tbarsmpl.cpp \
|
||||
textcmn.cpp \
|
||||
textfile.cpp \
|
||||
txtstrm.cpp \
|
||||
time.cpp \
|
||||
@@ -126,6 +128,7 @@ libwx_motif_la_SOURCES = \
|
||||
imaglist.cpp \
|
||||
laywin.cpp \
|
||||
listctrl.cpp \
|
||||
numdlgg.cpp \
|
||||
panelg.cpp \
|
||||
printps.cpp \
|
||||
prntdlgg.cpp \
|
||||
|
@@ -340,6 +340,12 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
|
||||
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
|
||||
@@ -632,10 +638,6 @@ bool wxApp::CheckForAccelerator(WXEvent* event)
|
||||
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(),
|
||||
@@ -655,7 +657,6 @@ bool wxApp::CheckForKeyDown(WXEvent* event)
|
||||
win->ProcessEvent( keyEvent );
|
||||
return (keyEvent.GetSkipped() != TRUE);
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "wx/motif/private.h"
|
||||
|
||||
#if wxUSE_XPM
|
||||
#if wxHAVE_LIB_XPM
|
||||
#include <X11/xpm.h>
|
||||
#endif
|
||||
|
||||
@@ -577,7 +577,7 @@ bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if wxUSE_XPM
|
||||
#if wxHAVE_LIB_XPM
|
||||
class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
|
||||
@@ -769,7 +769,7 @@ bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
|
||||
return M_BITMAPHANDLERDATA->m_ok ;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // wxHAVE_LIB_XPM
|
||||
|
||||
void wxBitmap::CleanUpHandlers()
|
||||
{
|
||||
@@ -790,12 +790,12 @@ void wxBitmap::InitStandardHandlers()
|
||||
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)
|
||||
|
@@ -70,7 +70,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
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,
|
||||
@@ -164,8 +164,7 @@ wxChoice::~wxChoice()
|
||||
|
||||
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
|
||||
|
@@ -53,7 +53,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID 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,
|
||||
|
@@ -31,7 +31,11 @@ wxControl::wxControl()
|
||||
{
|
||||
m_backgroundColour = *wxWHITE;
|
||||
m_foregroundColour = *wxBLACK;
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
m_callback = 0;
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
m_inSetValue = FALSE;
|
||||
}
|
||||
|
||||
@@ -89,43 +93,17 @@ wxString wxControl::GetLabel() const
|
||||
}
|
||||
}
|
||||
|
||||
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 WXWIN_COMPATIBILITY
|
||||
if ( m_callback )
|
||||
{
|
||||
(void) (*(m_callback)) (*this, event);
|
||||
(void)(*m_callback)(this, event);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetEventHandler()->OnCommand(*this, event);
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void wxControl::Centre (int direction)
|
||||
{
|
||||
int x, y, width, height, panel_width, panel_height, new_x, new_y;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -60,8 +60,6 @@ wxList wxModalDialogs;
|
||||
wxList wxModelessWindows; // Frames and modeless dialogs
|
||||
extern wxList wxPendingDelete;
|
||||
|
||||
extern wxHashTable *wxWidgetHashTable;
|
||||
|
||||
#define wxUSE_INVISIBLE_RESIZE 1
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
|
@@ -50,8 +50,6 @@
|
||||
|
||||
#include "wx/motif/private.h"
|
||||
|
||||
extern wxHashTable *wxWidgetHashTable;
|
||||
|
||||
void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
|
||||
void wxFrameFocusProc(Widget workArea, XtPointer clientData,
|
||||
XmAnyCallbackStruct *cbs);
|
||||
@@ -150,8 +148,18 @@ bool wxFrame::Create(wxWindow *parent,
|
||||
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();
|
||||
@@ -192,6 +200,9 @@ bool wxFrame::Create(wxWindow *parent,
|
||||
// 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);
|
||||
|
||||
@@ -202,9 +213,6 @@ bool wxFrame::Create(wxWindow *parent,
|
||||
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 ;
|
||||
|
@@ -778,9 +778,7 @@ bool wxMenuBar::CreateMenuBar(wxFrame* parent)
|
||||
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
|
||||
@@ -910,8 +908,9 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
|
||||
|
||||
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
|
||||
@@ -923,8 +922,6 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
|
||||
|
||||
if (mnem != 0)
|
||||
XtVaSetValues (buttonWidget, XmNmnemonic, mnem, NULL);
|
||||
|
||||
XmStringFree (label_str);
|
||||
}
|
||||
|
||||
m_menuWidget = (WXWidget) menu;
|
||||
|
@@ -142,22 +142,22 @@ void wxMenuItem::CreateItem (WXWidget menu, wxMenuBar * menuBar, wxMenu * topMen
|
||||
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);
|
||||
@@ -166,14 +166,13 @@ void wxMenuItem::CreateItem (WXWidget menu, wxMenuBar * menuBar, wxMenu * topMen
|
||||
|
||||
//// 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);
|
||||
@@ -267,26 +266,23 @@ void wxMenuItem::DestroyItem(bool full)
|
||||
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);
|
||||
|
@@ -88,9 +88,9 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
|
||||
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,
|
||||
@@ -101,11 +101,11 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
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,
|
||||
@@ -113,8 +113,6 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
XmNfontList, fontList,
|
||||
XmNlabelString, text,
|
||||
NULL);
|
||||
|
||||
XmStringFree (text);
|
||||
}
|
||||
|
||||
Widget frameWidget = XtVaCreateManagedWidget ("frame",
|
||||
|
@@ -17,14 +17,9 @@
|
||||
|
||||
#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)
|
||||
{
|
||||
@@ -34,8 +29,7 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
InitBase();
|
||||
|
||||
m_windowId = (id == -1) ? NewControlId() : id;
|
||||
|
||||
@@ -63,9 +57,8 @@ void wxSpinButton::SetValue(int val)
|
||||
|
||||
void wxSpinButton::SetRange(int minVal, int maxVal)
|
||||
{
|
||||
m_min = minVal;
|
||||
m_max = maxVal;
|
||||
// TODO
|
||||
wxSpinButtonBase::SetRange(minVal, maxVal);
|
||||
}
|
||||
|
||||
void wxSpinButton::ChangeFont(bool keepOriginalSize)
|
||||
@@ -82,12 +75,3 @@ void wxSpinButton::ChangeForegroundColour()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Spin event
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
||||
|
||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
|
||||
wxScrollEvent(commandType, id)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -83,9 +83,6 @@ static void wxTextWindowActivateProc(Widget w, XtPointer clientData, XmAnyCallba
|
||||
|
||||
// Text item
|
||||
wxTextCtrl::wxTextCtrl()
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
: streambuf()
|
||||
#endif
|
||||
{
|
||||
m_tempCallbackStruct = (void*) NULL;
|
||||
m_modified = FALSE;
|
||||
@@ -587,161 +584,6 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@@ -725,7 +725,7 @@ char wxFindMnemonic (const char *s)
|
||||
return mnem;
|
||||
}
|
||||
|
||||
char * wxFindAccelerator (char *s)
|
||||
char * wxFindAccelerator (const char *s)
|
||||
{
|
||||
// The accelerator text is after the \t char.
|
||||
while (*s && *s != '\t')
|
||||
@@ -748,7 +748,7 @@ char * wxFindAccelerator (char *s)
|
||||
wxBuffer[0] = '\0';
|
||||
char *tmp = copystring (s);
|
||||
s = tmp;
|
||||
char *p = s;
|
||||
char *p = tmp;
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -763,8 +763,7 @@ char * wxFindAccelerator (char *s)
|
||||
strcat (wxBuffer, s);
|
||||
else
|
||||
strcat (wxBuffer, "Meta");
|
||||
s = p + 1;
|
||||
p = s;
|
||||
s = p++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -777,7 +776,7 @@ char * wxFindAccelerator (char *s)
|
||||
return wxBuffer;
|
||||
}
|
||||
|
||||
XmString wxFindAcceleratorText (char *s)
|
||||
XmString wxFindAcceleratorText (const char *s)
|
||||
{
|
||||
// The accelerator text is after the \t char.
|
||||
while (*s && *s != '\t')
|
||||
@@ -785,7 +784,7 @@ XmString wxFindAcceleratorText (char *s)
|
||||
if (*s == '\0')
|
||||
return (NULL);
|
||||
s++;
|
||||
XmString text = XmStringCreateSimple (s);
|
||||
XmString text = XmStringCreateSimple ((char *)s);
|
||||
return text;
|
||||
}
|
||||
|
||||
|
@@ -1671,6 +1671,9 @@ bool wxAddWindowToTable(Widget w, wxWindow *win)
|
||||
|
||||
wxWidgetHashTable->Put((long) w, win);
|
||||
|
||||
wxLogDebug("Widget 0x%08x <-> window %p (%s)",
|
||||
w, win, win->GetClassInfo()->GetClassName());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -113,6 +113,7 @@ libwx_msw_la_SOURCES = \
|
||||
dcpsg.cpp \
|
||||
gridg.cpp \
|
||||
laywin.cpp \
|
||||
numdlgg.cpp \
|
||||
panelg.cpp \
|
||||
progdlgg.cpp \
|
||||
prop.cpp \
|
||||
|
@@ -38,16 +38,15 @@
|
||||
|
||||
#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() ;
|
||||
@@ -73,8 +72,7 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
InitBase();
|
||||
|
||||
m_windowId = (id == -1) ? NewControlId() : id;
|
||||
|
||||
@@ -127,8 +125,7 @@ void wxSpinButton::SetValue(int val)
|
||||
|
||||
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));
|
||||
}
|
||||
@@ -188,12 +185,4 @@ bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Spin event
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
||||
|
||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id)
|
||||
: wxScrollEvent(commandType, id)
|
||||
{
|
||||
}
|
||||
|
||||
#endif // __WIN95__
|
||||
|
Reference in New Issue
Block a user