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
|
splitter.cpp G
|
||||||
statusbr.cpp G
|
statusbr.cpp G
|
||||||
tabg.cpp G
|
tabg.cpp G
|
||||||
|
numdlgg.cpp G
|
||||||
textdlgg.cpp G
|
textdlgg.cpp G
|
||||||
tipdlg.cpp G
|
tipdlg.cpp G
|
||||||
treectrl.cpp G 16
|
treectrl.cpp G 16
|
||||||
|
@@ -1307,11 +1307,10 @@ public:
|
|||||||
virtual void OnCommand(wxWindow& WXUNUSED(win),
|
virtual void OnCommand(wxWindow& WXUNUSED(win),
|
||||||
wxCommandEvent& WXUNUSED(event))
|
wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
wxFAIL_MSG("shouldn't be called any more");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called if child control has no
|
// Called if child control has no callback function
|
||||||
// callback function
|
|
||||||
// Default behaviour
|
|
||||||
virtual long Default()
|
virtual long Default()
|
||||||
{ return GetNextHandler() ? GetNextHandler()->Default() : 0; };
|
{ return GetNextHandler() ? GetNextHandler()->Default() : 0; };
|
||||||
#endif // WXWIN_COMPATIBILITY_2
|
#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
|
wxString WXDLLEXPORT
|
||||||
@@ -65,15 +65,5 @@ wxGetTextFromUser(const wxString& message,
|
|||||||
int y = -1,
|
int y = -1,
|
||||||
bool centre = TRUE);
|
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
|
#endif
|
||||||
// __TEXTDLGH_G__
|
// __TEXTDLGH_G__
|
||||||
|
@@ -61,13 +61,13 @@ enum {
|
|||||||
GSOCK_INPUT_FLAG = 1 << GSOCK_INPUT,
|
GSOCK_INPUT_FLAG = 1 << GSOCK_INPUT,
|
||||||
GSOCK_OUTPUT_FLAG = 1 << GSOCK_OUTPUT,
|
GSOCK_OUTPUT_FLAG = 1 << GSOCK_OUTPUT,
|
||||||
GSOCK_CONNECTION_FLAG = 1 << GSOCK_CONNECTION,
|
GSOCK_CONNECTION_FLAG = 1 << GSOCK_CONNECTION,
|
||||||
GSOCK_LOST_FLAG = 1 << GSOCK_LOST,
|
GSOCK_LOST_FLAG = 1 << GSOCK_LOST
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int GSocketEventFlags;
|
typedef int GSocketEventFlags;
|
||||||
|
|
||||||
typedef void (*GSocketFallback)(GSocket *socket, GSocketEvent event,
|
typedef void (*GSocketFallback)(GSocket *socket, GSocketEvent event,
|
||||||
char *cdata);
|
char *cdata);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -118,13 +118,13 @@ GSocketError GSocket_Connect(GSocket *socket, GSocketStream stream);
|
|||||||
/* Generic IO */
|
/* Generic IO */
|
||||||
|
|
||||||
/* Like recv(), send(), ... */
|
/* Like recv(), send(), ... */
|
||||||
/*
|
/*
|
||||||
NOTE: In case we read from a non-oriented connection, the incoming (outgoing)
|
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_Read(GSocket *socket, char *buffer, int size);
|
||||||
int GSocket_Write(GSocket *socket, const char *buffer,
|
int GSocket_Write(GSocket *socket, const char *buffer,
|
||||||
int size);
|
int size);
|
||||||
bool GSocket_DataAvailable(GSocket *socket);
|
bool GSocket_DataAvailable(GSocket *socket);
|
||||||
|
|
||||||
/* Flags */
|
/* Flags */
|
||||||
@@ -143,15 +143,15 @@ GSocketError GSocket_GetError(GSocket *socket);
|
|||||||
|
|
||||||
/* Callbacks */
|
/* Callbacks */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Only one fallback is possible for each event (INPUT, OUTPUT, CONNECTION, LOST)
|
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
|
input buffer
|
||||||
OUTPUT: The function is called when the system is sure the next write call
|
OUTPUT: The function is called when the system is sure the next write call
|
||||||
will not block
|
will not block
|
||||||
CONNECTION: Two cases is possible:
|
CONNECTION: Two cases is possible:
|
||||||
Client socket -> the connection is established
|
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
|
LOST: the connection is lost
|
||||||
|
|
||||||
SetFallback accepts a combination of these flags so a same callback can
|
SetFallback accepts a combination of these flags so a same callback can
|
||||||
@@ -163,7 +163,7 @@ GSocketError GSocket_GetError(GSocket *socket);
|
|||||||
CONNECTION -> GSocket_Accept()
|
CONNECTION -> GSocket_Accept()
|
||||||
*/
|
*/
|
||||||
void GSocket_SetFallback(GSocket *socket, GSocketEventFlags event,
|
void GSocket_SetFallback(GSocket *socket, GSocketEventFlags event,
|
||||||
GSocketFallback fallback, char *cdata);
|
GSocketFallback fallback, char *cdata);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
UnsetFallback will disables all fallbacks specified by "event".
|
UnsetFallback will disables all fallbacks specified by "event".
|
||||||
@@ -180,7 +180,7 @@ void GAddress_destroy(GAddress *address);
|
|||||||
void GAddress_SetFamily(GAddress *address, GAddressType type);
|
void GAddress_SetFamily(GAddress *address, GAddressType type);
|
||||||
GAddressType GAddress_GetFamily(GAddress *address);
|
GAddressType GAddress_GetFamily(GAddress *address);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The use of any of the next functions will set the address family to the adapted
|
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
|
one. For example if you use GAddress_INET_SetHostName, address family will be AF_INET
|
||||||
implicitely
|
implicitely
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
// Modified by:
|
// Modified by:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Robert Roebling
|
// Copyright: (c) Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __GTKSPINPUTTH__
|
#ifndef __GTKSPINPUTTH__
|
||||||
@@ -15,89 +15,46 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
|
||||||
|
|
||||||
#ifdef wxUSE_SPINBTN
|
|
||||||
|
|
||||||
#include "wx/object.h"
|
|
||||||
#include "wx/control.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// classes
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxSpinButton;
|
|
||||||
class wxSpinEvent;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxSpinButton
|
// wxSpinButton
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxSpinButton : public wxControl
|
class wxSpinButton : public wxSpinButtonBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
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)
|
|
||||||
|
|
||||||
public:
|
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
|
#endif
|
||||||
// __GTKSPINBUTTH__
|
// __GTKSPINBUTTH__
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
// Modified by:
|
// Modified by:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Robert Roebling
|
// Copyright: (c) Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __GTKSPINPUTTH__
|
#ifndef __GTKSPINPUTTH__
|
||||||
@@ -15,89 +15,46 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
|
||||||
|
|
||||||
#ifdef wxUSE_SPINBTN
|
|
||||||
|
|
||||||
#include "wx/object.h"
|
|
||||||
#include "wx/control.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// classes
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxSpinButton;
|
|
||||||
class wxSpinEvent;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxSpinButton
|
// wxSpinButton
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxSpinButton : public wxControl
|
class wxSpinButton : public wxSpinButtonBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
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)
|
|
||||||
|
|
||||||
public:
|
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
|
#endif
|
||||||
// __GTKSPINBUTTH__
|
// __GTKSPINBUTTH__
|
||||||
|
@@ -6,14 +6,14 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_BUTTON_H_
|
#ifndef _WX_BUTTON_H_
|
||||||
#define _WX_BUTTON_H_
|
#define _WX_BUTTON_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "button.h"
|
#pragma interface "button.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
@@ -24,31 +24,34 @@ WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr;
|
|||||||
// Pushbutton
|
// Pushbutton
|
||||||
class WXDLLEXPORT wxButton: public wxControl
|
class WXDLLEXPORT wxButton: public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
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,
|
public:
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
wxButton() { }
|
||||||
const wxSize& size = wxDefaultSize, long style = 0,
|
wxButton(wxWindow *parent,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
wxWindowID id,
|
||||||
const wxString& name = wxButtonNameStr);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void SetDefault();
|
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||||
virtual void Command(wxCommandEvent& event);
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize, long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = wxButtonNameStr);
|
||||||
|
|
||||||
// Implementation
|
virtual void SetDefault();
|
||||||
virtual void ChangeFont(bool keepOriginalSize = TRUE);
|
virtual void Command(wxCommandEvent& event);
|
||||||
virtual void ChangeBackgroundColour();
|
|
||||||
virtual void ChangeForegroundColour();
|
// Implementation
|
||||||
|
virtual void ChangeFont(bool keepOriginalSize = TRUE);
|
||||||
|
virtual void ChangeBackgroundColour();
|
||||||
|
virtual void ChangeForegroundColour();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -29,22 +29,28 @@ public:
|
|||||||
wxControl();
|
wxControl();
|
||||||
~wxControl();
|
~wxControl();
|
||||||
|
|
||||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
|
// simulates the event, returns TRUE if the event was processed
|
||||||
virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
|
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
|
||||||
// appropriate event handlers
|
|
||||||
|
// 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 void SetLabel(const wxString& label);
|
||||||
virtual wxString GetLabel() const ;
|
virtual wxString GetLabel() const ;
|
||||||
|
|
||||||
// Places item in centre of panel - so can't be used BEFORE panel->Fit()
|
#if WXWIN_COMPATIBILITY
|
||||||
void Centre(int direction = wxHORIZONTAL);
|
|
||||||
void Callback(const wxFunction function) { m_callback = function; }; // Adds callback
|
void Callback(const wxFunction function) { m_callback = function; }; // Adds callback
|
||||||
|
|
||||||
wxFunction GetCallback() { return m_callback; }
|
wxFunction GetCallback() { return m_callback; }
|
||||||
|
#endif // WXWIN_COMPATIBILITY
|
||||||
|
|
||||||
bool InSetValue() const { return m_inSetValue; }
|
bool InSetValue() const { return m_inSetValue; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
#if WXWIN_COMPATIBILITY
|
||||||
wxFunction m_callback; // Callback associated with the window
|
wxFunction m_callback; // Callback associated with the window
|
||||||
|
#endif // WXWIN_COMPATIBILITY
|
||||||
|
|
||||||
bool m_inSetValue; // Motif: prevent callbacks being called while
|
bool m_inSetValue; // Motif: prevent callbacks being called while
|
||||||
// in SetValue
|
// in SetValue
|
||||||
|
@@ -39,9 +39,15 @@ extern void wxDeleteWindowFromTable(Widget w);
|
|||||||
extern wxWindow *wxGetWindowFromTable(Widget w);
|
extern wxWindow *wxGetWindowFromTable(Widget w);
|
||||||
extern bool wxAddWindowToTable(Widget w, wxWindow *win);
|
extern bool wxAddWindowToTable(Widget w, wxWindow *win);
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// key events related functions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern char wxFindMnemonic(const char* s);
|
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 int wxCharCodeXToWX(KeySym keySym);
|
||||||
extern KeySym wxCharCodeWXToX(int id);
|
extern KeySym wxCharCodeWXToX(int id);
|
||||||
|
|
||||||
|
@@ -6,97 +6,61 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_SPINBUTT_H_
|
#ifndef _WX_SPINBUTT_H_
|
||||||
#define _WX_SPINBUTT_H_
|
#define _WX_SPINBUTT_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "spinbutt.h"
|
#pragma interface "spinbutt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/control.h"
|
class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase
|
||||||
#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
|
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||||
public:
|
|
||||||
/*
|
|
||||||
* Public interface
|
|
||||||
*/
|
|
||||||
|
|
||||||
wxSpinButton();
|
public:
|
||||||
|
wxSpinButton() { }
|
||||||
|
|
||||||
inline wxSpinButton(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
wxSpinButton(wxWindow *parent,
|
||||||
long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton")
|
wxWindowID id = -1,
|
||||||
{
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
Create(parent, id, pos, size, style, name);
|
const wxSize& size = wxDefaultSize,
|
||||||
}
|
long style = wxSP_VERTICAL,
|
||||||
~wxSpinButton();
|
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,
|
bool Create(wxWindow *parent,
|
||||||
long style = wxSP_VERTICAL, const wxString& name = "wxSpinButton");
|
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; }
|
||||||
|
|
||||||
int GetValue() const ;
|
// operations
|
||||||
void SetValue(int val) ;
|
void SetValue(int val);
|
||||||
void SetRange(int minVal, int maxVal) ;
|
void SetRange(int minVal, int maxVal);
|
||||||
inline int GetMin() const { return m_min; }
|
|
||||||
inline int GetMax() const { return m_max; }
|
|
||||||
|
|
||||||
// Operations
|
// Implementation
|
||||||
////////////////////////////////////////////////////////////////////////////
|
virtual void Command(wxCommandEvent& event) { (void)ProcessCommand(event); };
|
||||||
|
virtual void ChangeFont(bool keepOriginalSize = TRUE);
|
||||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
virtual void ChangeBackgroundColour();
|
||||||
|
virtual void ChangeForegroundColour();
|
||||||
// Implementation
|
|
||||||
virtual void ChangeFont(bool keepOriginalSize = TRUE);
|
|
||||||
virtual void ChangeBackgroundColour();
|
|
||||||
virtual void ChangeForegroundColour();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_min;
|
int m_min;
|
||||||
int m_max;
|
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
|
#endif
|
||||||
// _WX_SPINBUTT_H_
|
// _WX_SPINBUTT_H_
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_STATBMP_H_
|
#ifndef _WX_STATBMP_H_
|
||||||
@@ -47,8 +47,10 @@ public:
|
|||||||
|
|
||||||
virtual void SetBitmap(const wxBitmap& bitmap);
|
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||||
|
|
||||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
|
virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event))
|
||||||
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
wxBitmap& GetBitmap() const { return (wxBitmap&) m_messageBitmap; }
|
wxBitmap& GetBitmap() const { return (wxBitmap&) m_messageBitmap; }
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_STATBOX_H_
|
#ifndef _WX_STATBOX_H_
|
||||||
@@ -45,8 +45,10 @@ public:
|
|||||||
long style = 0,
|
long style = 0,
|
||||||
const wxString& name = wxStaticBoxNameStr);
|
const wxString& name = wxStaticBoxNameStr);
|
||||||
|
|
||||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
|
virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event))
|
||||||
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void SetLabel(const wxString& label);
|
void SetLabel(const wxString& label);
|
||||||
wxString GetLabel() const;
|
wxString GetLabel() const;
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_STATTEXT_H_
|
#ifndef _WX_STATTEXT_H_
|
||||||
@@ -22,35 +22,40 @@ WXDLLEXPORT_DATA(extern const char*) wxStaticTextNameStr;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxStaticText: public wxControl
|
class WXDLLEXPORT wxStaticText: public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
DECLARE_DYNAMIC_CLASS(wxStaticText)
|
||||||
public:
|
|
||||||
inline wxStaticText() { }
|
|
||||||
|
|
||||||
inline wxStaticText(wxWindow *parent, wxWindowID id,
|
public:
|
||||||
const wxString& label,
|
wxStaticText() { }
|
||||||
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,
|
wxStaticText(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
const wxString& name = wxStaticTextNameStr);
|
const wxString& name = wxStaticTextNameStr)
|
||||||
|
{
|
||||||
|
Create(parent, id, label, pos, size, style, name);
|
||||||
|
}
|
||||||
|
|
||||||
// operations
|
bool Create(wxWindow *parent, wxWindowID id,
|
||||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
|
const wxString& label,
|
||||||
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxStaticTextNameStr);
|
||||||
|
|
||||||
// Implementation
|
// implementation
|
||||||
virtual void ChangeFont(bool keepOriginalSize = TRUE);
|
// --------------
|
||||||
virtual void ChangeBackgroundColour();
|
|
||||||
virtual void ChangeForegroundColour();
|
// operations
|
||||||
|
virtual bool ProcessCommand(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void ChangeFont(bool keepOriginalSize = TRUE);
|
||||||
|
virtual void ChangeBackgroundColour();
|
||||||
|
virtual void ChangeForegroundColour();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -16,22 +16,11 @@
|
|||||||
#pragma interface "textctrl.h"
|
#pragma interface "textctrl.h"
|
||||||
#endif
|
#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*) wxTextCtrlNameStr;
|
||||||
WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
|
WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
|
||||||
|
|
||||||
// Single-line text item
|
// Single-line text item
|
||||||
class WXDLLEXPORT wxTextCtrl: public wxControl
|
class WXDLLEXPORT wxTextCtrl : public wxControl
|
||||||
#ifndef NO_TEXT_WINDOW_STREAM
|
|
||||||
, public streambuf
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
|
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
|
||||||
|
|
||||||
@@ -47,9 +36,6 @@ public:
|
|||||||
long style = 0,
|
long style = 0,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxTextCtrlNameStr)
|
const wxString& name = wxTextCtrlNameStr)
|
||||||
#ifndef NO_TEXT_WINDOW_STREAM
|
|
||||||
: streambuf()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Create(parent, id, value, pos, size, style, validator, name);
|
Create(parent, id, value, pos, size, style, validator, name);
|
||||||
}
|
}
|
||||||
@@ -101,20 +87,6 @@ public:
|
|||||||
virtual void GetSelection(long* from, long* to) const;
|
virtual void GetSelection(long* from, long* to) const;
|
||||||
virtual bool IsEditable() 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 LoadFile(const wxString& file);
|
||||||
virtual bool SaveFile(const wxString& file);
|
virtual bool SaveFile(const wxString& file);
|
||||||
virtual void WriteText(const wxString& text);
|
virtual void WriteText(const wxString& text);
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_SPINBUTT_H_
|
#ifndef _WX_SPINBUTT_H_
|
||||||
@@ -21,17 +21,8 @@
|
|||||||
|
|
||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
|
|
||||||
/*
|
|
||||||
The wxSpinButton is like a small scrollbar than is often placed next
|
|
||||||
to a text control.
|
|
||||||
|
|
||||||
wxSP_HORIZONTAL: horizontal spin button
|
class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase
|
||||||
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
|
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
DECLARE_DYNAMIC_CLASS(wxSpinButton)
|
||||||
|
|
||||||
@@ -64,49 +55,16 @@ public:
|
|||||||
// Attributes
|
// Attributes
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int GetValue() const ;
|
virtual int GetValue() const;
|
||||||
void SetValue(int val) ;
|
virtual void SetValue(int val);
|
||||||
void SetRange(int minVal, int maxVal);
|
virtual void SetRange(int minVal, int maxVal);
|
||||||
int GetMin() const { return m_min; }
|
|
||||||
int GetMax() const { return m_max; }
|
|
||||||
|
|
||||||
// Operations
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||||
WXWORD pos, WXHWND control);
|
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
|
#endif
|
||||||
// _WX_WIN95__
|
// _WX_WIN95__
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,19 +1,119 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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_
|
#ifndef _WX_SPINBUTT_H_BASE_
|
||||||
#define _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__)
|
#if defined(__WXMSW__)
|
||||||
#include "wx/msw/spinbutt.h"
|
#include "wx/msw/spinbutt.h"
|
||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
#include "wx/motif/spinbutt.h"
|
#include "wx/motif/spinbutt.h"
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
#include "wx/gtk/spinbutt.h"
|
#include "wx/gtk/spinbutt.h"
|
||||||
#elif defined(__WXQT__)
|
#elif defined(__WXQT__)
|
||||||
#include "wx/qt/spinbutt.h"
|
#include "wx/qt/spinbutt.h"
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
#include "wx/mac/spinbutt.h"
|
#include "wx/mac/spinbutt.h"
|
||||||
#elif defined(__WXSTUBS__)
|
#elif defined(__WXSTUBS__)
|
||||||
#include "wx/stubs/spinbutt.h"
|
#include "wx/stubs/spinbutt.h"
|
||||||
#endif
|
#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
|
#endif
|
||||||
// _WX_SPINBUTT_H_BASE_
|
// _WX_SPINBUTT_H_BASE_
|
||||||
|
@@ -7,5 +7,19 @@
|
|||||||
#include "wx/generic/textdlgg.h"
|
#include "wx/generic/textdlgg.h"
|
||||||
#endif
|
#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
|
#endif
|
||||||
// _WX_TEXTDLG_H_BASE_
|
// _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
|
// ... and attach this menu bar to the frame
|
||||||
SetMenuBar(menuBar);
|
SetMenuBar(menuBar);
|
||||||
|
|
||||||
|
(void)new wxTextCtrl(this, -1, "Hi!", wxPoint(20, 20),
|
||||||
|
wxSize(100, 30));
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
// create a status bar just for fun (by default with 1 pane only)
|
// create a status bar just for fun (by default with 1 pane only)
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
|
@@ -281,10 +281,10 @@ bool wxDocument::OnSaveDocument(const wxString& file)
|
|||||||
msgTitle = wxString(_("File error"));
|
msgTitle = wxString(_("File error"));
|
||||||
|
|
||||||
#if wxUSE_STD_IOSTREAM
|
#if wxUSE_STD_IOSTREAM
|
||||||
ofstream store(file.fn_str());
|
ofstream store(wxString(file.fn_str()));
|
||||||
if (store.fail() || store.bad())
|
if (store.fail() || store.bad())
|
||||||
#else
|
#else
|
||||||
wxFileOutputStream store(file.fn_str());
|
wxFileOutputStream store(wxString(file.fn_str()));
|
||||||
if (store.LastError() != 0)
|
if (store.LastError() != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -317,10 +317,10 @@ bool wxDocument::OnOpenDocument(const wxString& file)
|
|||||||
msgTitle = wxString(_("File error"));
|
msgTitle = wxString(_("File error"));
|
||||||
|
|
||||||
#if wxUSE_STD_IOSTREAM
|
#if wxUSE_STD_IOSTREAM
|
||||||
ifstream store(file.fn_str());
|
ifstream store(wxString(file.fn_str()));
|
||||||
if (store.fail() || store.bad())
|
if (store.fail() || store.bad())
|
||||||
#else
|
#else
|
||||||
wxFileInputStream store(file.fn_str());
|
wxFileInputStream store(wxString(file.fn_str()));
|
||||||
if (store.LastError() != 0)
|
if (store.LastError() != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@@ -16,6 +16,13 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#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
|
#if (wxUSE_FS_INET || wxUSE_FS_ZIP) && wxUSE_STREAMS
|
||||||
|
|
||||||
#include "wx/wfstream.h"
|
#include "wx/wfstream.h"
|
||||||
|
@@ -29,6 +29,11 @@ limitation)
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !wxUSE_SOCKETS
|
||||||
|
#undef wxUSE_FS_INET
|
||||||
|
#define wxUSE_FS_INET 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if wxUSE_FS_INET
|
#if wxUSE_FS_INET
|
||||||
|
|
||||||
#ifndef WXPRECOMP
|
#ifndef WXPRECOMP
|
||||||
|
@@ -17,6 +17,11 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !wxUSE_SOCKETS
|
||||||
|
#undef wxUSE_FS_ZIP
|
||||||
|
#define wxUSE_FS_ZIP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if wxUSE_FS_ZIP
|
#if wxUSE_FS_ZIP
|
||||||
|
|
||||||
#ifndef WXPRECOMP
|
#ifndef WXPRECOMP
|
||||||
|
@@ -69,13 +69,13 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
int rshift = 0, gshift = 0, bshift = 0;
|
int rshift = 0, gshift = 0, bshift = 0;
|
||||||
wxUint8 aByte;
|
wxUint8 aByte;
|
||||||
wxUint16 aWord;
|
wxUint16 aWord;
|
||||||
wxInt32 dbuf[4], aDword,
|
wxInt32 dbuf[4], aDword,
|
||||||
rmask = 0, gmask = 0, bmask = 0;
|
rmask = 0, gmask = 0, bmask = 0;
|
||||||
wxInt8 bbuf[4];
|
wxInt8 bbuf[4];
|
||||||
struct _cmap {
|
struct _cmap {
|
||||||
unsigned char r, g, b;
|
unsigned char r, g, b;
|
||||||
} *cmap = NULL;
|
} *cmap = NULL;
|
||||||
|
|
||||||
off_t start_offset = stream.TellI();
|
off_t start_offset = stream.TellI();
|
||||||
|
|
||||||
image->Destroy();
|
image->Destroy();
|
||||||
@@ -87,7 +87,9 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
stream.Read( &bbuf, 2 );
|
stream.Read( &bbuf, 2 );
|
||||||
stream.Read( dbuf, 4 * 4 );
|
stream.Read( dbuf, 4 * 4 );
|
||||||
|
|
||||||
|
#if 0 // unused
|
||||||
wxInt32 size = wxINT32_SWAP_ON_BE( dbuf[0] );
|
wxInt32 size = wxINT32_SWAP_ON_BE( dbuf[0] );
|
||||||
|
#endif
|
||||||
wxInt32 offset = wxINT32_SWAP_ON_BE( dbuf[2] );
|
wxInt32 offset = wxINT32_SWAP_ON_BE( dbuf[2] );
|
||||||
|
|
||||||
stream.Read(dbuf, 4 * 2);
|
stream.Read(dbuf, 4 * 2);
|
||||||
@@ -103,7 +105,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
wxLogError( _T("Image height > 32767 pixels for file.") );
|
wxLogError( _T("Image height > 32767 pixels for file.") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.Read( &aWord, 2 );
|
stream.Read( &aWord, 2 );
|
||||||
/*
|
/*
|
||||||
TODO
|
TODO
|
||||||
@@ -116,7 +118,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
wxLogError( _T("unknown bitdepth in file.") );
|
wxLogError( _T("unknown bitdepth in file.") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.Read( dbuf, 4 * 4 );
|
stream.Read( dbuf, 4 * 4 );
|
||||||
int comp = (int)wxINT32_SWAP_ON_BE( dbuf[0] );
|
int comp = (int)wxINT32_SWAP_ON_BE( dbuf[0] );
|
||||||
if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS)
|
if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS)
|
||||||
@@ -124,15 +126,15 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
wxLogError( _T("unknown encoding in Windows BMP file.") );
|
wxLogError( _T("unknown encoding in Windows BMP file.") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.Read( dbuf, 4 * 2 );
|
stream.Read( dbuf, 4 * 2 );
|
||||||
int ncolors = (int)wxINT32_SWAP_ON_BE( dbuf[0] );
|
int ncolors = (int)wxINT32_SWAP_ON_BE( dbuf[0] );
|
||||||
if (ncolors == 0)
|
if (ncolors == 0)
|
||||||
ncolors = 1 << bpp;
|
ncolors = 1 << bpp;
|
||||||
/* some more sanity checks */
|
/* some more sanity checks */
|
||||||
if (((comp == BI_RLE4) && (bpp != 4)) ||
|
if (((comp == BI_RLE4) && (bpp != 4)) ||
|
||||||
((comp == BI_RLE8) && (bpp != 8)) ||
|
((comp == BI_RLE8) && (bpp != 8)) ||
|
||||||
((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32)))
|
((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32)))
|
||||||
{
|
{
|
||||||
wxLogError( _T("encoding of BMP doesn't match bitdepth.") );
|
wxLogError( _T("encoding of BMP doesn't match bitdepth.") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -229,13 +231,13 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
}
|
}
|
||||||
ptr = data;
|
ptr = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
int line = 0;
|
int line = 0;
|
||||||
int column = 0;
|
int column = 0;
|
||||||
int linesize = ((width * bpp + 31) / 32) * 4;
|
int linesize = ((width * bpp + 31) / 32) * 4;
|
||||||
|
|
||||||
/* BMPs are stored upside down */
|
/* BMPs are stored upside down */
|
||||||
for (line = (height - 1); line >= 0; line--)
|
for (line = (height - 1); line >= 0; line--)
|
||||||
{
|
{
|
||||||
int linepos = 0;
|
int linepos = 0;
|
||||||
for (column = 0; column < width;)
|
for (column = 0; column < width;)
|
||||||
@@ -358,7 +360,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
{
|
{
|
||||||
unsigned char temp;
|
unsigned char temp;
|
||||||
stream.Read( &aWord, 2 );
|
stream.Read( &aWord, 2 );
|
||||||
aWord = wxUINT16_SWAP_ON_BE( aWord );
|
aWord = wxUINT16_SWAP_ON_BE( aWord );
|
||||||
linepos += 2;
|
linepos += 2;
|
||||||
temp = (aWord & rmask) >> rshift;
|
temp = (aWord & rmask) >> rshift;
|
||||||
ptr[poffset] = temp;
|
ptr[poffset] = temp;
|
||||||
@@ -372,7 +374,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
{
|
{
|
||||||
unsigned char temp;
|
unsigned char temp;
|
||||||
stream.Read( &aDword, 4 );
|
stream.Read( &aDword, 4 );
|
||||||
aDword = wxINT32_SWAP_ON_BE( aDword );
|
aDword = wxINT32_SWAP_ON_BE( aDword );
|
||||||
linepos += 4;
|
linepos += 4;
|
||||||
temp = (aDword & rmask) >> rshift;
|
temp = (aDword & rmask) >> rshift;
|
||||||
ptr[poffset] = temp;
|
ptr[poffset] = temp;
|
||||||
@@ -391,7 +393,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmap)
|
if (cmap)
|
||||||
free(cmap);
|
free(cmap);
|
||||||
|
|
||||||
image->SetMask( FALSE );
|
image->SetMask( FALSE );
|
||||||
|
@@ -54,7 +54,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent)
|
|||||||
|
|
||||||
class wxSocketState : public wxObject {
|
class wxSocketState : public wxObject {
|
||||||
public:
|
public:
|
||||||
bool notify_state;
|
bool notify_state;
|
||||||
GSocketEventFlags evt_notify_state;
|
GSocketEventFlags evt_notify_state;
|
||||||
wxSocketBase::wxSockFlags socket_flags;
|
wxSocketBase::wxSockFlags socket_flags;
|
||||||
wxSocketBase::wxSockCbk c_callback;
|
wxSocketBase::wxSockCbk c_callback;
|
||||||
@@ -112,7 +112,7 @@ wxSocketBase::~wxSocketBase()
|
|||||||
|
|
||||||
bool wxSocketBase::Close()
|
bool wxSocketBase::Close()
|
||||||
{
|
{
|
||||||
if (m_socket)
|
if (m_socket)
|
||||||
{
|
{
|
||||||
if (m_notify_state == TRUE)
|
if (m_notify_state == TRUE)
|
||||||
Notify(FALSE);
|
Notify(FALSE);
|
||||||
@@ -140,7 +140,7 @@ int wxSocketBase::DeferRead(char *buffer, size_t nbytes)
|
|||||||
|
|
||||||
old_event_flags = NeededReq();
|
old_event_flags = NeededReq();
|
||||||
old_notify_state = m_notify_state;
|
old_notify_state = m_notify_state;
|
||||||
|
|
||||||
SetNotify(GSOCK_INPUT_FLAG | GSOCK_LOST_FLAG);
|
SetNotify(GSOCK_INPUT_FLAG | GSOCK_LOST_FLAG);
|
||||||
Notify(TRUE);
|
Notify(TRUE);
|
||||||
|
|
||||||
@@ -415,7 +415,7 @@ void wxSocketBase::Discard()
|
|||||||
SaveState();
|
SaveState();
|
||||||
SetFlags(NOWAIT | SPEED);
|
SetFlags(NOWAIT | SPEED);
|
||||||
|
|
||||||
while (recv_size == MAX_BUFSIZE)
|
while (recv_size == MAX_BUFSIZE)
|
||||||
{
|
{
|
||||||
recv_size = Read(my_data, MAX_BUFSIZE).LastCount();
|
recv_size = Read(my_data, MAX_BUFSIZE).LastCount();
|
||||||
}
|
}
|
||||||
@@ -593,7 +593,7 @@ bool wxSocketBase::WaitForLost(long seconds, long milliseconds)
|
|||||||
|
|
||||||
GSocketEventFlags wxSocketBase::EventToNotify(GSocketEvent evt)
|
GSocketEventFlags wxSocketBase::EventToNotify(GSocketEvent evt)
|
||||||
{
|
{
|
||||||
switch (evt)
|
switch (evt)
|
||||||
{
|
{
|
||||||
case GSOCK_INPUT:
|
case GSOCK_INPUT:
|
||||||
return GSOCK_INPUT_FLAG;
|
return GSOCK_INPUT_FLAG;
|
||||||
@@ -724,7 +724,7 @@ void wxSocketBase::CreatePushbackBefore(const char *buffer, size_t size)
|
|||||||
|
|
||||||
m_unread = tmp;
|
m_unread = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_unrd_size += size;
|
m_unrd_size += size;
|
||||||
|
|
||||||
memcpy(m_unread, buffer, size);
|
memcpy(m_unread, buffer, size);
|
||||||
@@ -870,9 +870,9 @@ bool wxSocketClient::WaitOnConnect(long seconds, long microseconds)
|
|||||||
|
|
||||||
void wxSocketClient::OnRequest(GSocketEvent evt)
|
void wxSocketClient::OnRequest(GSocketEvent evt)
|
||||||
{
|
{
|
||||||
if (evt == GSOCK_CONNECTION)
|
if (evt == GSOCK_CONNECTION)
|
||||||
{
|
{
|
||||||
if (m_connected)
|
if (m_connected)
|
||||||
{
|
{
|
||||||
m_neededreq &= ~GSOCK_CONNECTION_FLAG;
|
m_neededreq &= ~GSOCK_CONNECTION_FLAG;
|
||||||
return;
|
return;
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
@@ -39,7 +41,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxExtHelpController, wxHTMLHelpControllerBase)
|
IMPLEMENT_CLASS(wxExtHelpController, wxHTMLHelpControllerBase)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class implements help via an external browser.
|
This class implements help via an external browser.
|
||||||
It requires the name of a directory containing the documentation
|
It requires the name of a directory containing the documentation
|
||||||
@@ -109,7 +111,7 @@ wxExtHelpController::DisplayHelp(wxString const &relativeURL)
|
|||||||
long success;
|
long success;
|
||||||
command << m_BrowserName << _T(" -remote openURL(")
|
command << m_BrowserName << _T(" -remote openURL(")
|
||||||
<< _T("file://") << m_MapFile
|
<< _T("file://") << m_MapFile
|
||||||
<< WXEXTHELP_SEPARATOR << relativeURL << _T(")");
|
<< WXEXTHELP_SEPARATOR << relativeURL << _T(")");
|
||||||
success = wxExecute(command);
|
success = wxExecute(command);
|
||||||
if(success != 0 ) // returns PID on success
|
if(success != 0 ) // returns PID on success
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -117,9 +119,10 @@ wxExtHelpController::DisplayHelp(wxString const &relativeURL)
|
|||||||
}
|
}
|
||||||
command = m_BrowserName;
|
command = m_BrowserName;
|
||||||
command << _T(" file://")
|
command << _T(" file://")
|
||||||
<< m_MapFile << WXEXTHELP_SEPARATOR << relativeURL;
|
<< m_MapFile << WXEXTHELP_SEPARATOR << relativeURL;
|
||||||
return wxExecute(command) != 0;
|
return wxExecute(command) != 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_HELP
|
||||||
|
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_HELP
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
#include "wx/string.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"
|
#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
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -89,11 +60,6 @@ static const int wxID_TEXT = 3000;
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#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)
|
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
|
||||||
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
|
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
@@ -168,129 +134,3 @@ void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
EndModal(wxID_OK);
|
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 \
|
imaglist.cpp \
|
||||||
laywin.cpp \
|
laywin.cpp \
|
||||||
listctrl.cpp \
|
listctrl.cpp \
|
||||||
|
numdlgg.cpp \
|
||||||
panelg.cpp \
|
panelg.cpp \
|
||||||
printps.cpp \
|
printps.cpp \
|
||||||
prntdlgg.cpp \
|
prntdlgg.cpp \
|
||||||
|
@@ -59,7 +59,7 @@ gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
|||||||
event.SetInt( combo->GetSelection() );
|
event.SetInt( combo->GetSelection() );
|
||||||
event.SetString( combo->GetStringSelection() );
|
event.SetString( combo->GetStringSelection() );
|
||||||
event.SetEventObject( combo );
|
event.SetEventObject( combo );
|
||||||
|
|
||||||
combo->GetEventHandler()->ProcessEvent( event );
|
combo->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ static void
|
|||||||
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!combo->m_hasVMT) return;
|
if (!combo->m_hasVMT) return;
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
||||||
@@ -126,7 +126,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
/* don't send first event, which GTK sends aways when
|
/* don't send first event, which GTK sends aways when
|
||||||
inserting the first item */
|
inserting the first item */
|
||||||
m_alreadySent = TRUE;
|
m_alreadySent = TRUE;
|
||||||
|
|
||||||
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
|
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
|
||||||
|
|
||||||
m_clientDataList.Append( (wxObject*)NULL );
|
m_clientDataList.Append( (wxObject*)NULL );
|
||||||
@@ -360,8 +360,6 @@ int wxComboBox::GetSelection() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFAIL_MSG( _T("wxComboBox: no selection") );
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -596,7 +594,7 @@ void wxComboBox::DisableEvents()
|
|||||||
GList *child = list->children;
|
GList *child = list->children;
|
||||||
while (child)
|
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 );
|
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||||
|
|
||||||
child = child->next;
|
child = child->next;
|
||||||
@@ -619,7 +617,7 @@ void wxComboBox::EnableEvents()
|
|||||||
void wxComboBox::OnSize( wxSizeEvent &event )
|
void wxComboBox::OnSize( wxSizeEvent &event )
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int w = 21;
|
int w = 21;
|
||||||
|
@@ -21,15 +21,18 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
|
||||||
|
|
||||||
wxControl::wxControl(void)
|
wxControl::wxControl()
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxControl::wxControl( wxWindow *parent, wxWindowID id,
|
wxControl::wxControl( wxWindow *parent,
|
||||||
const wxPoint &pos, const wxSize &size,
|
wxWindowID id,
|
||||||
long style, const wxString &name ) :
|
const wxPoint &pos,
|
||||||
wxWindow( parent, id, pos, size, style, name )
|
const wxSize &size,
|
||||||
|
long style,
|
||||||
|
const wxString &name )
|
||||||
|
: wxWindow( parent, id, pos, size, style, name )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,10 +43,10 @@ void wxControl::Command( wxCommandEvent &WXUNUSED(event) )
|
|||||||
void wxControl::SetLabel( const wxString &label )
|
void wxControl::SetLabel( const wxString &label )
|
||||||
{
|
{
|
||||||
m_label = _T("");
|
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
|
pc++; // skip it
|
||||||
#if 0 // it would be unused anyhow for now - kbd interface not done yet
|
#if 0 // it would be unused anyhow for now - kbd interface not done yet
|
||||||
if ( *pc != _T('&') ) m_chAccel = *pc;
|
if ( *pc != _T('&') ) m_chAccel = *pc;
|
||||||
|
@@ -78,17 +78,18 @@ static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *wi
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton,wxControl)
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxSpinButton, wxControl)
|
BEGIN_EVENT_TABLE(wxSpinButton, wxControl)
|
||||||
EVT_SIZE(wxSpinButton::OnSize)
|
EVT_SIZE(wxSpinButton::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxSpinButton::wxSpinButton()
|
bool wxSpinButton::Create(wxWindow *parent,
|
||||||
{
|
wxWindowID id,
|
||||||
}
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
long style,
|
||||||
long style, const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
|
|
||||||
@@ -201,15 +202,4 @@ void wxSpinButton::ApplyWidgetStyle()
|
|||||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
#endif
|
||||||
// wxSpinEvent
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
|
||||||
|
|
||||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
|
|
||||||
wxScrollEvent(commandType, id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@@ -46,7 +46,7 @@ void wxStaticBitmap::CreatePixmapWidget()
|
|||||||
|
|
||||||
/* insert GTK representation */
|
/* insert GTK representation */
|
||||||
(*m_parent->m_insertCallback)(m_parent, this);
|
(*m_parent->m_insertCallback)(m_parent, this);
|
||||||
|
|
||||||
gtk_widget_show( m_widget );
|
gtk_widget_show( m_widget );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
@@ -81,7 +81,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
@@ -100,17 +100,17 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
|
|||||||
{
|
{
|
||||||
gtk_widget_destroy( m_widget );
|
gtk_widget_destroy( m_widget );
|
||||||
|
|
||||||
/* recreate m_widget because we've created a label
|
/* recreate m_widget because we've created a label
|
||||||
and not a bitmap above */
|
and not a bitmap above */
|
||||||
CreatePixmapWidget();
|
CreatePixmapWidget();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||||
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
|
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
|
||||||
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
|
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -127,6 +127,7 @@ libwx_gtk_la_SOURCES = \
|
|||||||
imaglist.cpp \
|
imaglist.cpp \
|
||||||
laywin.cpp \
|
laywin.cpp \
|
||||||
listctrl.cpp \
|
listctrl.cpp \
|
||||||
|
numdlgg.cpp \
|
||||||
panelg.cpp \
|
panelg.cpp \
|
||||||
printps.cpp \
|
printps.cpp \
|
||||||
prntdlgg.cpp \
|
prntdlgg.cpp \
|
||||||
|
@@ -59,7 +59,7 @@ gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
|||||||
event.SetInt( combo->GetSelection() );
|
event.SetInt( combo->GetSelection() );
|
||||||
event.SetString( combo->GetStringSelection() );
|
event.SetString( combo->GetStringSelection() );
|
||||||
event.SetEventObject( combo );
|
event.SetEventObject( combo );
|
||||||
|
|
||||||
combo->GetEventHandler()->ProcessEvent( event );
|
combo->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ static void
|
|||||||
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!combo->m_hasVMT) return;
|
if (!combo->m_hasVMT) return;
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
||||||
@@ -126,7 +126,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
/* don't send first event, which GTK sends aways when
|
/* don't send first event, which GTK sends aways when
|
||||||
inserting the first item */
|
inserting the first item */
|
||||||
m_alreadySent = TRUE;
|
m_alreadySent = TRUE;
|
||||||
|
|
||||||
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
|
GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() );
|
||||||
|
|
||||||
m_clientDataList.Append( (wxObject*)NULL );
|
m_clientDataList.Append( (wxObject*)NULL );
|
||||||
@@ -360,8 +360,6 @@ int wxComboBox::GetSelection() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFAIL_MSG( _T("wxComboBox: no selection") );
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -596,7 +594,7 @@ void wxComboBox::DisableEvents()
|
|||||||
GList *child = list->children;
|
GList *child = list->children;
|
||||||
while (child)
|
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 );
|
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||||
|
|
||||||
child = child->next;
|
child = child->next;
|
||||||
@@ -619,7 +617,7 @@ void wxComboBox::EnableEvents()
|
|||||||
void wxComboBox::OnSize( wxSizeEvent &event )
|
void wxComboBox::OnSize( wxSizeEvent &event )
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int w = 21;
|
int w = 21;
|
||||||
|
@@ -21,15 +21,18 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
|
||||||
|
|
||||||
wxControl::wxControl(void)
|
wxControl::wxControl()
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxControl::wxControl( wxWindow *parent, wxWindowID id,
|
wxControl::wxControl( wxWindow *parent,
|
||||||
const wxPoint &pos, const wxSize &size,
|
wxWindowID id,
|
||||||
long style, const wxString &name ) :
|
const wxPoint &pos,
|
||||||
wxWindow( parent, id, pos, size, style, name )
|
const wxSize &size,
|
||||||
|
long style,
|
||||||
|
const wxString &name )
|
||||||
|
: wxWindow( parent, id, pos, size, style, name )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,10 +43,10 @@ void wxControl::Command( wxCommandEvent &WXUNUSED(event) )
|
|||||||
void wxControl::SetLabel( const wxString &label )
|
void wxControl::SetLabel( const wxString &label )
|
||||||
{
|
{
|
||||||
m_label = _T("");
|
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
|
pc++; // skip it
|
||||||
#if 0 // it would be unused anyhow for now - kbd interface not done yet
|
#if 0 // it would be unused anyhow for now - kbd interface not done yet
|
||||||
if ( *pc != _T('&') ) m_chAccel = *pc;
|
if ( *pc != _T('&') ) m_chAccel = *pc;
|
||||||
|
@@ -78,17 +78,18 @@ static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *wi
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton,wxControl)
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxSpinButton, wxControl)
|
BEGIN_EVENT_TABLE(wxSpinButton, wxControl)
|
||||||
EVT_SIZE(wxSpinButton::OnSize)
|
EVT_SIZE(wxSpinButton::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxSpinButton::wxSpinButton()
|
bool wxSpinButton::Create(wxWindow *parent,
|
||||||
{
|
wxWindowID id,
|
||||||
}
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
long style,
|
||||||
long style, const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
|
|
||||||
@@ -201,15 +202,4 @@ void wxSpinButton::ApplyWidgetStyle()
|
|||||||
gtk_widget_set_style( m_widget, m_widgetStyle );
|
gtk_widget_set_style( m_widget, m_widgetStyle );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
#endif
|
||||||
// wxSpinEvent
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
|
||||||
|
|
||||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
|
|
||||||
wxScrollEvent(commandType, id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@@ -46,7 +46,7 @@ void wxStaticBitmap::CreatePixmapWidget()
|
|||||||
|
|
||||||
/* insert GTK representation */
|
/* insert GTK representation */
|
||||||
(*m_parent->m_insertCallback)(m_parent, this);
|
(*m_parent->m_insertCallback)(m_parent, this);
|
||||||
|
|
||||||
gtk_widget_show( m_widget );
|
gtk_widget_show( m_widget );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
@@ -81,7 +81,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
|||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
@@ -100,17 +100,17 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
|
|||||||
{
|
{
|
||||||
gtk_widget_destroy( m_widget );
|
gtk_widget_destroy( m_widget );
|
||||||
|
|
||||||
/* recreate m_widget because we've created a label
|
/* recreate m_widget because we've created a label
|
||||||
and not a bitmap above */
|
and not a bitmap above */
|
||||||
CreatePixmapWidget();
|
CreatePixmapWidget();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||||
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
|
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
|
||||||
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
|
SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,6 +61,7 @@ libwx_motif_la_SOURCES = \
|
|||||||
docview.cpp \
|
docview.cpp \
|
||||||
dynlib.cpp \
|
dynlib.cpp \
|
||||||
event.cpp \
|
event.cpp \
|
||||||
|
ffile.cpp \
|
||||||
file.cpp \
|
file.cpp \
|
||||||
fileconf.cpp \
|
fileconf.cpp \
|
||||||
filesys.cpp \
|
filesys.cpp \
|
||||||
@@ -99,6 +100,7 @@ libwx_motif_la_SOURCES = \
|
|||||||
stream.cpp \
|
stream.cpp \
|
||||||
tbarbase.cpp \
|
tbarbase.cpp \
|
||||||
tbarsmpl.cpp \
|
tbarsmpl.cpp \
|
||||||
|
textcmn.cpp \
|
||||||
textfile.cpp \
|
textfile.cpp \
|
||||||
txtstrm.cpp \
|
txtstrm.cpp \
|
||||||
time.cpp \
|
time.cpp \
|
||||||
@@ -126,6 +128,7 @@ libwx_motif_la_SOURCES = \
|
|||||||
imaglist.cpp \
|
imaglist.cpp \
|
||||||
laywin.cpp \
|
laywin.cpp \
|
||||||
listctrl.cpp \
|
listctrl.cpp \
|
||||||
|
numdlgg.cpp \
|
||||||
panelg.cpp \
|
panelg.cpp \
|
||||||
printps.cpp \
|
printps.cpp \
|
||||||
prntdlgg.cpp \
|
prntdlgg.cpp \
|
||||||
|
@@ -340,6 +340,12 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
|
|
||||||
if (event->type == KeyPress)
|
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))
|
if (CheckForAccelerator(_event))
|
||||||
{
|
{
|
||||||
// Do nothing! We intercepted and processed the event as an
|
// Do nothing! We intercepted and processed the event as an
|
||||||
@@ -632,10 +638,6 @@ bool wxApp::CheckForAccelerator(WXEvent* event)
|
|||||||
bool wxApp::CheckForKeyDown(WXEvent* event)
|
bool wxApp::CheckForKeyDown(WXEvent* event)
|
||||||
{
|
{
|
||||||
XEvent* xEvent = (XEvent*) 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)
|
if (xEvent->xany.type == KeyPress)
|
||||||
{
|
{
|
||||||
Widget widget = XtWindowToWidget((Display*) wxGetDisplay(),
|
Widget widget = XtWindowToWidget((Display*) wxGetDisplay(),
|
||||||
@@ -655,7 +657,6 @@ bool wxApp::CheckForKeyDown(WXEvent* event)
|
|||||||
win->ProcessEvent( keyEvent );
|
win->ProcessEvent( keyEvent );
|
||||||
return (keyEvent.GetSkipped() != TRUE);
|
return (keyEvent.GetSkipped() != TRUE);
|
||||||
}
|
}
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -26,13 +26,13 @@
|
|||||||
|
|
||||||
#include "wx/motif/private.h"
|
#include "wx/motif/private.h"
|
||||||
|
|
||||||
#if wxUSE_XPM
|
#if wxHAVE_LIB_XPM
|
||||||
#include <X11/xpm.h>
|
#include <X11/xpm.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARIES
|
#if !USE_SHARED_LIBRARIES
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxBitmapRefData::wxBitmapRefData()
|
wxBitmapRefData::wxBitmapRefData()
|
||||||
@@ -44,14 +44,14 @@ wxBitmapRefData::wxBitmapRefData()
|
|||||||
m_quality = 0;
|
m_quality = 0;
|
||||||
m_numColors = 0;
|
m_numColors = 0;
|
||||||
m_bitmapMask = NULL;
|
m_bitmapMask = NULL;
|
||||||
|
|
||||||
m_pixmap = (WXPixmap) 0;
|
m_pixmap = (WXPixmap) 0;
|
||||||
m_display = (WXDisplay*) 0;
|
m_display = (WXDisplay*) 0;
|
||||||
|
|
||||||
m_freePixmap = TRUE; //TODO: necessary?
|
m_freePixmap = TRUE; //TODO: necessary?
|
||||||
m_freeColors = (unsigned long*) 0;
|
m_freeColors = (unsigned long*) 0;
|
||||||
m_freeColorsCount = 0;
|
m_freeColorsCount = 0;
|
||||||
|
|
||||||
// These 5 variables are for wxControl
|
// These 5 variables are for wxControl
|
||||||
m_insensPixmap = (WXPixmap) 0;
|
m_insensPixmap = (WXPixmap) 0;
|
||||||
m_labelPixmap = (WXPixmap) 0;
|
m_labelPixmap = (WXPixmap) 0;
|
||||||
@@ -64,19 +64,19 @@ wxBitmapRefData::~wxBitmapRefData()
|
|||||||
{
|
{
|
||||||
if (m_labelPixmap)
|
if (m_labelPixmap)
|
||||||
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_labelPixmap);
|
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_labelPixmap);
|
||||||
|
|
||||||
if (m_armPixmap)
|
if (m_armPixmap)
|
||||||
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_armPixmap);
|
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_armPixmap);
|
||||||
|
|
||||||
if (m_insensPixmap)
|
if (m_insensPixmap)
|
||||||
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_insensPixmap);
|
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_insensPixmap);
|
||||||
|
|
||||||
if (m_image)
|
if (m_image)
|
||||||
{
|
{
|
||||||
XmUninstallImage ((XImage*) m_image);
|
XmUninstallImage ((XImage*) m_image);
|
||||||
XtFree ((char *) (XImage*) m_image);
|
XtFree ((char *) (XImage*) m_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_insensImage)
|
if (m_insensImage)
|
||||||
{
|
{
|
||||||
XmUninstallImage ((XImage*) m_insensImage);
|
XmUninstallImage ((XImage*) m_insensImage);
|
||||||
@@ -85,7 +85,7 @@ wxBitmapRefData::~wxBitmapRefData()
|
|||||||
}
|
}
|
||||||
if (m_pixmap && m_freePixmap)
|
if (m_pixmap && m_freePixmap)
|
||||||
XFreePixmap ((Display*) m_display, (Pixmap) m_pixmap);
|
XFreePixmap ((Display*) m_display, (Pixmap) m_pixmap);
|
||||||
|
|
||||||
if (m_freeColors)
|
if (m_freeColors)
|
||||||
{
|
{
|
||||||
int screen = DefaultScreen((Display*) m_display);
|
int screen = DefaultScreen((Display*) m_display);
|
||||||
@@ -95,7 +95,7 @@ wxBitmapRefData::~wxBitmapRefData()
|
|||||||
XFreeColors((Display*) m_display, cmp, &m_freeColors[llp], 1, 0L);
|
XFreeColors((Display*) m_display, cmp, &m_freeColors[llp], 1, 0L);
|
||||||
delete m_freeColors;
|
delete m_freeColors;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (m_bitmapMask)
|
if (m_bitmapMask)
|
||||||
delete m_bitmapMask;
|
delete m_bitmapMask;
|
||||||
m_bitmapMask = NULL;
|
m_bitmapMask = NULL;
|
||||||
@@ -106,7 +106,7 @@ wxList wxBitmap::sm_handlers;
|
|||||||
wxBitmap::wxBitmap()
|
wxBitmap::wxBitmap()
|
||||||
{
|
{
|
||||||
m_refData = NULL;
|
m_refData = NULL;
|
||||||
|
|
||||||
if ( wxTheBitmapList )
|
if ( wxTheBitmapList )
|
||||||
wxTheBitmapList->AddBitmap(this);
|
wxTheBitmapList->AddBitmap(this);
|
||||||
}
|
}
|
||||||
@@ -120,9 +120,9 @@ wxBitmap::~wxBitmap()
|
|||||||
wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
|
wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
|
||||||
{
|
{
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
(void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, depth);
|
(void) Create((void*) bits, wxBITMAP_TYPE_XBM_DATA, width, height, depth);
|
||||||
|
|
||||||
if ( wxTheBitmapList )
|
if ( wxTheBitmapList )
|
||||||
wxTheBitmapList->AddBitmap(this);
|
wxTheBitmapList->AddBitmap(this);
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth)
|
|||||||
wxBitmap::wxBitmap(int w, int h, int d)
|
wxBitmap::wxBitmap(int w, int h, int d)
|
||||||
{
|
{
|
||||||
(void)Create(w, h, d);
|
(void)Create(w, h, d);
|
||||||
|
|
||||||
if ( wxTheBitmapList )
|
if ( wxTheBitmapList )
|
||||||
wxTheBitmapList->AddBitmap(this);
|
wxTheBitmapList->AddBitmap(this);
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ wxBitmap::wxBitmap(int w, int h, int d)
|
|||||||
wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth)
|
wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth)
|
||||||
{
|
{
|
||||||
(void) Create(data, type, width, height, depth);
|
(void) Create(data, type, width, height, depth);
|
||||||
|
|
||||||
if ( wxTheBitmapList )
|
if ( wxTheBitmapList )
|
||||||
wxTheBitmapList->AddBitmap(this);
|
wxTheBitmapList->AddBitmap(this);
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth)
|
|||||||
wxBitmap::wxBitmap(const wxString& filename, long type)
|
wxBitmap::wxBitmap(const wxString& filename, long type)
|
||||||
{
|
{
|
||||||
LoadFile(filename, (int)type);
|
LoadFile(filename, (int)type);
|
||||||
|
|
||||||
if ( wxTheBitmapList )
|
if ( wxTheBitmapList )
|
||||||
wxTheBitmapList->AddBitmap(this);
|
wxTheBitmapList->AddBitmap(this);
|
||||||
}
|
}
|
||||||
@@ -157,33 +157,33 @@ wxBitmap::wxBitmap(char **data, wxControl* control)
|
|||||||
{
|
{
|
||||||
// Pass the control to the Create function using a global
|
// Pass the control to the Create function using a global
|
||||||
sg_Control = control;
|
sg_Control = control;
|
||||||
|
|
||||||
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
|
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
|
||||||
|
|
||||||
sg_Control = (wxControl*) NULL;
|
sg_Control = (wxControl*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBitmap::Create(int w, int h, int d)
|
bool wxBitmap::Create(int w, int h, int d)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
if (d < 1)
|
if (d < 1)
|
||||||
d = wxDisplayDepth();
|
d = wxDisplayDepth();
|
||||||
|
|
||||||
M_BITMAPDATA->m_width = w;
|
M_BITMAPDATA->m_width = w;
|
||||||
M_BITMAPDATA->m_height = h;
|
M_BITMAPDATA->m_height = h;
|
||||||
M_BITMAPDATA->m_depth = d;
|
M_BITMAPDATA->m_depth = d;
|
||||||
M_BITMAPDATA->m_freePixmap = TRUE;
|
M_BITMAPDATA->m_freePixmap = TRUE;
|
||||||
|
|
||||||
Display *dpy = (Display*) wxGetDisplay();
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
|
|
||||||
M_BITMAPDATA->m_display = dpy; /* MATTHEW: [4] Remember the display */
|
M_BITMAPDATA->m_display = dpy; /* MATTHEW: [4] Remember the display */
|
||||||
|
|
||||||
M_BITMAPDATA->m_pixmap = (WXPixmap) XCreatePixmap (dpy, RootWindow (dpy, DefaultScreen (dpy)),
|
M_BITMAPDATA->m_pixmap = (WXPixmap) XCreatePixmap (dpy, RootWindow (dpy, DefaultScreen (dpy)),
|
||||||
w, h, d);
|
w, h, d);
|
||||||
|
|
||||||
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_pixmap != (WXPixmap) 0) ;
|
M_BITMAPDATA->m_ok = (M_BITMAPDATA->m_pixmap != (WXPixmap) 0) ;
|
||||||
return M_BITMAPDATA->m_ok;
|
return M_BITMAPDATA->m_ok;
|
||||||
}
|
}
|
||||||
@@ -191,47 +191,47 @@ bool wxBitmap::Create(int w, int h, int d)
|
|||||||
bool wxBitmap::LoadFile(const wxString& filename, long type)
|
bool wxBitmap::LoadFile(const wxString& filename, long type)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
wxBitmapHandler *handler = FindHandler(type);
|
wxBitmapHandler *handler = FindHandler(type);
|
||||||
|
|
||||||
if ( handler == NULL ) {
|
if ( handler == NULL ) {
|
||||||
wxLogWarning("%s: no bitmap handler for type %d defined.", (const char*) filename, type);
|
wxLogWarning("%s: no bitmap handler for type %d defined.", (const char*) filename, type);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler->LoadFile(this, filename, type, -1, -1);
|
return handler->LoadFile(this, filename, type, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
|
bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
wxBitmapHandler *handler = FindHandler(type);
|
wxBitmapHandler *handler = FindHandler(type);
|
||||||
|
|
||||||
if ( handler == NULL ) {
|
if ( handler == NULL ) {
|
||||||
wxLogWarning("no data bitmap handler for type %d defined.", type);
|
wxLogWarning("no data bitmap handler for type %d defined.", type);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler->Create(this, data, type, width, height, depth);
|
return handler->Create(this, data, type, width, height, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *palette)
|
bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *palette)
|
||||||
{
|
{
|
||||||
wxBitmapHandler *handler = FindHandler(type);
|
wxBitmapHandler *handler = FindHandler(type);
|
||||||
|
|
||||||
if ( handler == NULL ) {
|
if ( handler == NULL ) {
|
||||||
wxLogWarning("no bitmap handler for type %d defined.", type);
|
wxLogWarning("no bitmap handler for type %d defined.", type);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler->SaveFile(this, filename, type, palette);
|
return handler->SaveFile(this, filename, type, palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ void wxBitmap::SetWidth(int w)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
M_BITMAPDATA->m_width = w;
|
M_BITMAPDATA->m_width = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ void wxBitmap::SetHeight(int h)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
M_BITMAPDATA->m_height = h;
|
M_BITMAPDATA->m_height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ void wxBitmap::SetDepth(int d)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
M_BITMAPDATA->m_depth = d;
|
M_BITMAPDATA->m_depth = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ void wxBitmap::SetQuality(int q)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
M_BITMAPDATA->m_quality = q;
|
M_BITMAPDATA->m_quality = q;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +271,7 @@ void wxBitmap::SetOk(bool isOk)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
M_BITMAPDATA->m_ok = isOk;
|
M_BITMAPDATA->m_ok = isOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ void wxBitmap::SetPalette(const wxPalette& palette)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
M_BITMAPDATA->m_bitmapPalette = palette ;
|
M_BITMAPDATA->m_bitmapPalette = palette ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ void wxBitmap::SetMask(wxMask *mask)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
M_BITMAPDATA->m_bitmapMask = mask ;
|
M_BITMAPDATA->m_bitmapMask = mask ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ wxMask::wxMask()
|
|||||||
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
||||||
{
|
{
|
||||||
m_pixmap = (WXPixmap) 0;
|
m_pixmap = (WXPixmap) 0;
|
||||||
|
|
||||||
Create(bitmap, colour);
|
Create(bitmap, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
|||||||
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
|
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
|
||||||
{
|
{
|
||||||
m_pixmap = (WXPixmap) 0;
|
m_pixmap = (WXPixmap) 0;
|
||||||
|
|
||||||
Create(bitmap, paletteIndex);
|
Create(bitmap, paletteIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
|
|||||||
wxMask::wxMask(const wxBitmap& bitmap)
|
wxMask::wxMask(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
m_pixmap = (WXPixmap) 0;
|
m_pixmap = (WXPixmap) 0;
|
||||||
|
|
||||||
Create(bitmap);
|
Create(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,7 +424,7 @@ bool wxMask::Create(const wxBitmap& WXUNUSED(bitmap), const wxColour& WXUNUSED(c
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
|
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))
|
int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -436,7 +436,7 @@ bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNU
|
|||||||
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))
|
const wxPalette *WXUNUSED(palette))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -456,7 +456,7 @@ public:
|
|||||||
m_extension = "xbm";
|
m_extension = "xbm";
|
||||||
m_type = wxBITMAP_TYPE_XBM;
|
m_type = wxBITMAP_TYPE_XBM;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||||
int desiredWidth, int desiredHeight);
|
int desiredWidth, int desiredHeight);
|
||||||
};
|
};
|
||||||
@@ -466,21 +466,21 @@ bool wxXBMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long WXU
|
|||||||
int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight))
|
int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight))
|
||||||
{
|
{
|
||||||
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
|
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
|
||||||
|
|
||||||
int hotX, hotY;
|
int hotX, hotY;
|
||||||
unsigned int w, h;
|
unsigned int w, h;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
|
|
||||||
Display *dpy = (Display*) wxGetDisplay();
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
M_BITMAPDATA->m_display = (WXDisplay*) dpy;
|
M_BITMAPDATA->m_display = (WXDisplay*) dpy;
|
||||||
|
|
||||||
int value = XReadBitmapFile (dpy, RootWindow (dpy, DefaultScreen (dpy)),
|
int value = XReadBitmapFile (dpy, RootWindow (dpy, DefaultScreen (dpy)),
|
||||||
(char*) (const char*) name, &w, &h, &pixmap, &hotX, &hotY);
|
(char*) (const char*) name, &w, &h, &pixmap, &hotX, &hotY);
|
||||||
M_BITMAPHANDLERDATA->m_width = w;
|
M_BITMAPHANDLERDATA->m_width = w;
|
||||||
M_BITMAPHANDLERDATA->m_height = h;
|
M_BITMAPHANDLERDATA->m_height = h;
|
||||||
M_BITMAPHANDLERDATA->m_depth = 1;
|
M_BITMAPHANDLERDATA->m_depth = 1;
|
||||||
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap;
|
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap;
|
||||||
|
|
||||||
if ((value == BitmapFileInvalid) ||
|
if ((value == BitmapFileInvalid) ||
|
||||||
(value == BitmapOpenFailed) ||
|
(value == BitmapOpenFailed) ||
|
||||||
(value == BitmapNoMemory))
|
(value == BitmapNoMemory))
|
||||||
@@ -490,7 +490,7 @@ bool wxXBMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long WXU
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
M_BITMAPHANDLERDATA->m_ok = TRUE;
|
M_BITMAPHANDLERDATA->m_ok = TRUE;
|
||||||
|
|
||||||
return M_BITMAPHANDLERDATA->m_ok ;
|
return M_BITMAPHANDLERDATA->m_ok ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,25 +504,25 @@ public:
|
|||||||
m_extension = "xbm";
|
m_extension = "xbm";
|
||||||
m_type = wxBITMAP_TYPE_XBM_DATA;
|
m_type = wxBITMAP_TYPE_XBM_DATA;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
|
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
|
||||||
};
|
};
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxXBMDataHandler, wxBitmapHandler)
|
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))
|
int width, int height, int WXUNUSED(depth))
|
||||||
{
|
{
|
||||||
M_BITMAPHANDLERDATA->m_width = width;
|
M_BITMAPHANDLERDATA->m_width = width;
|
||||||
M_BITMAPHANDLERDATA->m_height = height;
|
M_BITMAPHANDLERDATA->m_height = height;
|
||||||
M_BITMAPHANDLERDATA->m_depth = 1;
|
M_BITMAPHANDLERDATA->m_depth = 1;
|
||||||
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
|
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
|
||||||
|
|
||||||
Display *dpy = (Display*) wxGetDisplay();
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) XCreateBitmapFromData (dpy, RootWindow (dpy, DefaultScreen (dpy)), (char*) data, width, height);
|
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) ;
|
M_BITMAPHANDLERDATA->m_ok = (M_BITMAPHANDLERDATA->m_pixmap != (WXPixmap) 0) ;
|
||||||
|
|
||||||
// code for wxControl. TODO: can we avoid doing this until we need it?
|
// code for wxControl. TODO: can we avoid doing this until we need it?
|
||||||
// E.g. have CreateButtonPixmaps which is called on demand.
|
// E.g. have CreateButtonPixmaps which is called on demand.
|
||||||
XImage* image = (XImage *) XtMalloc (sizeof (XImage));
|
XImage* image = (XImage *) XtMalloc (sizeof (XImage));
|
||||||
@@ -537,13 +537,13 @@ bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
|
|||||||
image->bitmap_bit_order = LSBFirst;
|
image->bitmap_bit_order = LSBFirst;
|
||||||
image->bitmap_pad = 8;
|
image->bitmap_pad = 8;
|
||||||
image->bytes_per_line = (width + 7) >> 3;
|
image->bytes_per_line = (width + 7) >> 3;
|
||||||
|
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
sprintf (tmp, "Im%x", (unsigned int) image);
|
sprintf (tmp, "Im%x", (unsigned int) image);
|
||||||
XmInstallImage (image, tmp);
|
XmInstallImage (image, tmp);
|
||||||
|
|
||||||
// Build our manually stipped pixmap.
|
// Build our manually stipped pixmap.
|
||||||
|
|
||||||
int bpl = (width + 7) / 8;
|
int bpl = (width + 7) / 8;
|
||||||
char *data1 = new char[height * bpl];
|
char *data1 = new char[height * bpl];
|
||||||
char* bits = (char*) data;
|
char* bits = (char*) data;
|
||||||
@@ -567,17 +567,17 @@ bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
|
|||||||
insensImage->bitmap_bit_order = LSBFirst;
|
insensImage->bitmap_bit_order = LSBFirst;
|
||||||
insensImage->bitmap_pad = 8;
|
insensImage->bitmap_pad = 8;
|
||||||
insensImage->bytes_per_line = bpl;
|
insensImage->bytes_per_line = bpl;
|
||||||
|
|
||||||
sprintf (tmp, "Not%x", (unsigned int)insensImage);
|
sprintf (tmp, "Not%x", (unsigned int)insensImage);
|
||||||
XmInstallImage (insensImage, tmp);
|
XmInstallImage (insensImage, tmp);
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_image = (WXImage*) image;
|
M_BITMAPHANDLERDATA->m_image = (WXImage*) image;
|
||||||
M_BITMAPHANDLERDATA->m_insensImage = (WXImage*) insensImage;
|
M_BITMAPHANDLERDATA->m_insensImage = (WXImage*) insensImage;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_XPM
|
#if wxHAVE_LIB_XPM
|
||||||
class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler
|
class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
|
DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
|
||||||
@@ -588,7 +588,7 @@ public:
|
|||||||
m_extension = "xpm";
|
m_extension = "xpm";
|
||||||
m_type = wxBITMAP_TYPE_XPM;
|
m_type = wxBITMAP_TYPE_XPM;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||||
int desiredWidth, int desiredHeight);
|
int desiredWidth, int desiredHeight);
|
||||||
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
|
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
|
||||||
@@ -601,18 +601,18 @@ bool wxXPMFileHandler::LoadFile( wxBitmap *bitmap, const wxString& name, long WX
|
|||||||
{
|
{
|
||||||
Display *dpy = (Display*) wxGetDisplay();
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
||||||
|
|
||||||
XpmAttributes xpmAttr;
|
XpmAttributes xpmAttr;
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
Pixmap mask = 0;
|
Pixmap mask = 0;
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_ok = FALSE;
|
M_BITMAPHANDLERDATA->m_ok = FALSE;
|
||||||
xpmAttr.valuemask = XpmReturnInfos | XpmCloseness;
|
xpmAttr.valuemask = XpmReturnInfos | XpmCloseness;
|
||||||
xpmAttr.closeness = 40000;
|
xpmAttr.closeness = 40000;
|
||||||
int errorStatus = XpmReadFileToPixmap(dpy,
|
int errorStatus = XpmReadFileToPixmap(dpy,
|
||||||
RootWindow(dpy, DefaultScreen(dpy)), (char*) (const char*) name,
|
RootWindow(dpy, DefaultScreen(dpy)), (char*) (const char*) name,
|
||||||
&pixmap, &mask, &xpmAttr);
|
&pixmap, &mask, &xpmAttr);
|
||||||
|
|
||||||
if (errorStatus == XpmSuccess)
|
if (errorStatus == XpmSuccess)
|
||||||
{
|
{
|
||||||
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap;
|
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap;
|
||||||
@@ -621,17 +621,17 @@ bool wxXPMFileHandler::LoadFile( wxBitmap *bitmap, const wxString& name, long WX
|
|||||||
M_BITMAPHANDLERDATA->m_bitmapMask = new wxMask;
|
M_BITMAPHANDLERDATA->m_bitmapMask = new wxMask;
|
||||||
M_BITMAPHANDLERDATA->m_bitmapMask->SetPixmap((WXPixmap) mask);
|
M_BITMAPHANDLERDATA->m_bitmapMask->SetPixmap((WXPixmap) mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int depthRet;
|
unsigned int depthRet;
|
||||||
int xRet, yRet;
|
int xRet, yRet;
|
||||||
unsigned int widthRet, heightRet, borderWidthRet;
|
unsigned int widthRet, heightRet, borderWidthRet;
|
||||||
Window rootWindowRet;
|
Window rootWindowRet;
|
||||||
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
|
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
|
||||||
&widthRet, &heightRet, &borderWidthRet, &depthRet);
|
&widthRet, &heightRet, &borderWidthRet, &depthRet);
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
|
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
|
||||||
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
|
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ( xpmAttr.npixels > 2 )
|
if ( xpmAttr.npixels > 2 )
|
||||||
{
|
{
|
||||||
@@ -641,13 +641,13 @@ bool wxXPMFileHandler::LoadFile( wxBitmap *bitmap, const wxString& name, long WX
|
|||||||
M_BITMAPHANDLERDATA->m_depth = 1; // mono
|
M_BITMAPHANDLERDATA->m_depth = 1; // mono
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_depth = depthRet;
|
M_BITMAPHANDLERDATA->m_depth = depthRet;
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
|
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
|
||||||
|
|
||||||
XpmFreeAttributes(&xpmAttr);
|
XpmFreeAttributes(&xpmAttr);
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_ok = TRUE;
|
M_BITMAPHANDLERDATA->m_ok = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else
|
} else
|
||||||
@@ -658,7 +658,7 @@ bool wxXPMFileHandler::LoadFile( wxBitmap *bitmap, const wxString& name, long WX
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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))
|
const wxPalette *WXUNUSED(palette))
|
||||||
{
|
{
|
||||||
if (M_BITMAPHANDLERDATA->m_ok && M_BITMAPHANDLERDATA->m_pixmap)
|
if (M_BITMAPHANDLERDATA->m_ok && M_BITMAPHANDLERDATA->m_pixmap)
|
||||||
@@ -687,26 +687,26 @@ public:
|
|||||||
m_extension = "xpm";
|
m_extension = "xpm";
|
||||||
m_type = wxBITMAP_TYPE_XPM_DATA;
|
m_type = wxBITMAP_TYPE_XPM_DATA;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
|
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
|
||||||
};
|
};
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
|
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))
|
int width, int height, int WXUNUSED(depth))
|
||||||
{
|
{
|
||||||
M_BITMAPHANDLERDATA->m_width = width;
|
M_BITMAPHANDLERDATA->m_width = width;
|
||||||
M_BITMAPHANDLERDATA->m_height = height;
|
M_BITMAPHANDLERDATA->m_height = height;
|
||||||
M_BITMAPHANDLERDATA->m_depth = 1;
|
M_BITMAPHANDLERDATA->m_depth = 1;
|
||||||
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
|
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
|
||||||
|
|
||||||
Display *dpy = (Display*) wxGetDisplay();
|
Display *dpy = (Display*) wxGetDisplay();
|
||||||
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
|
||||||
|
|
||||||
XpmAttributes xpmAttr;
|
XpmAttributes xpmAttr;
|
||||||
|
|
||||||
xpmAttr.valuemask = XpmReturnInfos; /* nothing yet, but get infos back */
|
xpmAttr.valuemask = XpmReturnInfos; /* nothing yet, but get infos back */
|
||||||
|
|
||||||
XpmColorSymbol symbolicColors[4];
|
XpmColorSymbol symbolicColors[4];
|
||||||
if (sg_Control && sg_Control->GetMainWidget())
|
if (sg_Control && sg_Control->GetMainWidget())
|
||||||
{
|
{
|
||||||
@@ -721,7 +721,7 @@ bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
|
|||||||
xpmAttr.colorsymbols = symbolicColors;
|
xpmAttr.colorsymbols = symbolicColors;
|
||||||
xpmAttr.valuemask |= XpmColorSymbols; // add flag
|
xpmAttr.valuemask |= XpmColorSymbols; // add flag
|
||||||
}
|
}
|
||||||
|
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
Pixmap mask = 0;
|
Pixmap mask = 0;
|
||||||
int ErrorStatus = XpmCreatePixmapFromData(dpy, RootWindow(dpy, DefaultScreen(dpy)),
|
int ErrorStatus = XpmCreatePixmapFromData(dpy, RootWindow(dpy, DefaultScreen(dpy)),
|
||||||
@@ -731,14 +731,14 @@ bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
|
|||||||
// Set attributes
|
// Set attributes
|
||||||
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
|
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
|
||||||
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
|
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
|
||||||
|
|
||||||
unsigned int depthRet;
|
unsigned int depthRet;
|
||||||
int xRet, yRet;
|
int xRet, yRet;
|
||||||
unsigned int widthRet, heightRet, borderWidthRet;
|
unsigned int widthRet, heightRet, borderWidthRet;
|
||||||
Window rootWindowRet;
|
Window rootWindowRet;
|
||||||
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
|
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
|
||||||
&widthRet, &heightRet, &borderWidthRet, &depthRet);
|
&widthRet, &heightRet, &borderWidthRet, &depthRet);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ( xpmAttr.npixels > 2 )
|
if ( xpmAttr.npixels > 2 )
|
||||||
{
|
{
|
||||||
@@ -748,9 +748,9 @@ bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
|
|||||||
M_BITMAPHANDLERDATA->m_depth = 1; // mono
|
M_BITMAPHANDLERDATA->m_depth = 1; // mono
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_depth = depthRet;
|
M_BITMAPHANDLERDATA->m_depth = depthRet;
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
|
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
|
||||||
XpmFreeAttributes(&xpmAttr);
|
XpmFreeAttributes(&xpmAttr);
|
||||||
M_BITMAPHANDLERDATA->m_ok = TRUE;
|
M_BITMAPHANDLERDATA->m_ok = TRUE;
|
||||||
@@ -769,7 +769,7 @@ bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
|
|||||||
return M_BITMAPHANDLERDATA->m_ok ;
|
return M_BITMAPHANDLERDATA->m_ok ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // wxHAVE_LIB_XPM
|
||||||
|
|
||||||
void wxBitmap::CleanUpHandlers()
|
void wxBitmap::CleanUpHandlers()
|
||||||
{
|
{
|
||||||
@@ -789,35 +789,35 @@ void wxBitmap::InitStandardHandlers()
|
|||||||
// Initialize all standard bitmap or derived class handlers here.
|
// Initialize all standard bitmap or derived class handlers here.
|
||||||
AddHandler(new wxXBMFileHandler);
|
AddHandler(new wxXBMFileHandler);
|
||||||
AddHandler(new wxXBMDataHandler);
|
AddHandler(new wxXBMDataHandler);
|
||||||
|
|
||||||
// XPM is considered standard for Motif, although it can be omitted if absolutely
|
// XPM is considered standard for Motif, although it can be omitted if
|
||||||
// necessary.
|
// libXpm is not installed
|
||||||
#if wxUSE_XPM
|
#if wxHAVE_LIB_XPM
|
||||||
AddHandler(new wxXPMFileHandler);
|
AddHandler(new wxXPMFileHandler);
|
||||||
AddHandler(new wxXPMDataHandler);
|
AddHandler(new wxXPMDataHandler);
|
||||||
#endif
|
#endif // wxHAVE_LIB_XPM
|
||||||
}
|
}
|
||||||
|
|
||||||
WXPixmap wxBitmap::GetLabelPixmap (WXWidget w)
|
WXPixmap wxBitmap::GetLabelPixmap (WXWidget w)
|
||||||
{
|
{
|
||||||
if (M_BITMAPDATA->m_image == (WXPixmap) 0)
|
if (M_BITMAPDATA->m_image == (WXPixmap) 0)
|
||||||
return M_BITMAPDATA->m_pixmap;
|
return M_BITMAPDATA->m_pixmap;
|
||||||
|
|
||||||
Display *dpy = (Display*) M_BITMAPDATA->m_display;
|
Display *dpy = (Display*) M_BITMAPDATA->m_display;
|
||||||
|
|
||||||
#ifdef FOO
|
#ifdef FOO
|
||||||
/*
|
/*
|
||||||
If we do:
|
If we do:
|
||||||
if (labelPixmap) return labelPixmap;
|
if (labelPixmap) return labelPixmap;
|
||||||
things can be wrong, because colors can have been changed.
|
things can be wrong, because colors can have been changed.
|
||||||
|
|
||||||
If we do:
|
If we do:
|
||||||
if (labelPixmap)
|
if (labelPixmap)
|
||||||
XmDestroyPixmap(DefaultScreenOfDisplay(dpy),labelPixmap) ;
|
XmDestroyPixmap(DefaultScreenOfDisplay(dpy),labelPixmap) ;
|
||||||
we got BadDrawable if the pixmap is referenced by multiples widgets
|
we got BadDrawable if the pixmap is referenced by multiples widgets
|
||||||
|
|
||||||
this is a catch22!!
|
this is a catch22!!
|
||||||
|
|
||||||
So, before doing thing really clean, I just do nothing; if the pixmap is
|
So, before doing thing really clean, I just do nothing; if the pixmap is
|
||||||
referenced by many widgets, Motif performs caching functions.
|
referenced by many widgets, Motif performs caching functions.
|
||||||
And if pixmap is referenced with multiples colors, we just have some
|
And if pixmap is referenced with multiples colors, we just have some
|
||||||
@@ -827,19 +827,19 @@ WXPixmap wxBitmap::GetLabelPixmap (WXWidget w)
|
|||||||
if (M_BITMAPDATA->m_labelPixmap)
|
if (M_BITMAPDATA->m_labelPixmap)
|
||||||
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_labelPixmap);
|
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_labelPixmap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
|
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
|
||||||
|
|
||||||
Pixel fg, bg;
|
Pixel fg, bg;
|
||||||
Widget widget = (Widget) w;
|
Widget widget = (Widget) w;
|
||||||
|
|
||||||
while (XmIsGadget ( widget ))
|
while (XmIsGadget ( widget ))
|
||||||
widget = XtParent (widget);
|
widget = XtParent (widget);
|
||||||
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
|
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
|
||||||
|
|
||||||
M_BITMAPDATA->m_labelPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
M_BITMAPDATA->m_labelPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
||||||
|
|
||||||
return M_BITMAPDATA->m_labelPixmap;
|
return M_BITMAPDATA->m_labelPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -847,7 +847,7 @@ WXPixmap wxBitmap::GetArmPixmap (WXWidget w)
|
|||||||
{
|
{
|
||||||
if (M_BITMAPDATA->m_image == (WXPixmap) 0)
|
if (M_BITMAPDATA->m_image == (WXPixmap) 0)
|
||||||
return M_BITMAPDATA->m_pixmap;
|
return M_BITMAPDATA->m_pixmap;
|
||||||
|
|
||||||
Display *dpy = (Display*) M_BITMAPDATA->m_display;
|
Display *dpy = (Display*) M_BITMAPDATA->m_display;
|
||||||
#ifdef FOO
|
#ifdef FOO
|
||||||
See GetLabelPixmap () comment
|
See GetLabelPixmap () comment
|
||||||
@@ -855,30 +855,30 @@ WXPixmap wxBitmap::GetArmPixmap (WXWidget w)
|
|||||||
if (M_BITMAPDATA->m_armPixmap)
|
if (M_BITMAPDATA->m_armPixmap)
|
||||||
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_armPixmap);
|
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_armPixmap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
|
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
|
||||||
|
|
||||||
Pixel fg, bg;
|
Pixel fg, bg;
|
||||||
Widget widget = (Widget) w;
|
Widget widget = (Widget) w;
|
||||||
|
|
||||||
XtVaGetValues (widget, XmNarmColor, &bg, NULL);
|
XtVaGetValues (widget, XmNarmColor, &bg, NULL);
|
||||||
while (XmIsGadget (widget))
|
while (XmIsGadget (widget))
|
||||||
widget = XtParent (widget);
|
widget = XtParent (widget);
|
||||||
XtVaGetValues (widget, XmNforeground, &fg, NULL);
|
XtVaGetValues (widget, XmNforeground, &fg, NULL);
|
||||||
|
|
||||||
M_BITMAPDATA->m_armPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
M_BITMAPDATA->m_armPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
||||||
|
|
||||||
return M_BITMAPDATA->m_armPixmap;
|
return M_BITMAPDATA->m_armPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
|
WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
|
||||||
{
|
{
|
||||||
Display *dpy = (Display*) M_BITMAPDATA->m_display;
|
Display *dpy = (Display*) M_BITMAPDATA->m_display;
|
||||||
|
|
||||||
if (M_BITMAPDATA->m_insensPixmap)
|
if (M_BITMAPDATA->m_insensPixmap)
|
||||||
return M_BITMAPDATA->m_insensPixmap;
|
return M_BITMAPDATA->m_insensPixmap;
|
||||||
|
|
||||||
if (!w)
|
if (!w)
|
||||||
{
|
{
|
||||||
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XCreateInsensitivePixmap(dpy, (Pixmap) M_BITMAPDATA->m_pixmap);
|
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XCreateInsensitivePixmap(dpy, (Pixmap) M_BITMAPDATA->m_pixmap);
|
||||||
@@ -887,29 +887,29 @@ WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
|
|||||||
else
|
else
|
||||||
return M_BITMAPDATA->m_pixmap;
|
return M_BITMAPDATA->m_pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (M_BITMAPDATA->m_insensImage == (WXPixmap) 0)
|
if (M_BITMAPDATA->m_insensImage == (WXPixmap) 0)
|
||||||
return M_BITMAPDATA->m_pixmap;
|
return M_BITMAPDATA->m_pixmap;
|
||||||
|
|
||||||
#ifdef FOO
|
#ifdef FOO
|
||||||
See GetLabelPixmap () comment
|
See GetLabelPixmap () comment
|
||||||
// Must be destroyed, because colours can have been changed!
|
// Must be destroyed, because colours can have been changed!
|
||||||
if (M_BITMAPDATA->m_insensPixmap)
|
if (M_BITMAPDATA->m_insensPixmap)
|
||||||
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), (Pixmap) M_BITMAPDATA->m_insensPixmap);
|
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), (Pixmap) M_BITMAPDATA->m_insensPixmap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
sprintf (tmp, "Not%x", (unsigned int) M_BITMAPDATA->m_insensImage);
|
sprintf (tmp, "Not%x", (unsigned int) M_BITMAPDATA->m_insensImage);
|
||||||
|
|
||||||
Pixel fg, bg;
|
Pixel fg, bg;
|
||||||
Widget widget = (Widget) w;
|
Widget widget = (Widget) w;
|
||||||
|
|
||||||
while (XmIsGadget (widget))
|
while (XmIsGadget (widget))
|
||||||
widget = XtParent (widget);
|
widget = XtParent (widget);
|
||||||
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
|
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
|
||||||
|
|
||||||
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
||||||
|
|
||||||
return M_BITMAPDATA->m_insensPixmap;
|
return M_BITMAPDATA->m_insensPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -919,32 +919,32 @@ WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
|
|||||||
|
|
||||||
NAME
|
NAME
|
||||||
XCreateInsensitivePixmap - create a grayed-out copy of a pixmap
|
XCreateInsensitivePixmap - create a grayed-out copy of a pixmap
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This function creates a grayed-out copy of the argument pixmap, suitable
|
This function creates a grayed-out copy of the argument pixmap, suitable
|
||||||
for use as a XmLabel's XmNlabelInsensitivePixmap resource.
|
for use as a XmLabel's XmNlabelInsensitivePixmap resource.
|
||||||
|
|
||||||
RETURN VALUES
|
RETURN VALUES
|
||||||
The return value is the new Pixmap id or zero on error. Errors include
|
The return value is the new Pixmap id or zero on error. Errors include
|
||||||
a NULL display argument or an invalid Pixmap argument.
|
a NULL display argument or an invalid Pixmap argument.
|
||||||
|
|
||||||
ERRORS
|
ERRORS
|
||||||
If one of the XLib functions fail, it will produce a X error. The
|
If one of the XLib functions fail, it will produce a X error. The
|
||||||
default X error handler prints a diagnostic and calls exit().
|
default X error handler prints a diagnostic and calls exit().
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
XCopyArea(3), XCreateBitmapFromData(3), XCreateGC(3), XCreatePixmap(3),
|
XCopyArea(3), XCreateBitmapFromData(3), XCreateGC(3), XCreatePixmap(3),
|
||||||
XFillRectangle(3), exit(2)
|
XFillRectangle(3), exit(2)
|
||||||
|
|
||||||
AUTHOR
|
AUTHOR
|
||||||
John R Veregge - john@puente.jpl.nasa.gov
|
John R Veregge - john@puente.jpl.nasa.gov
|
||||||
Advanced Engineering and Prototyping Group (AEG)
|
Advanced Engineering and Prototyping Group (AEG)
|
||||||
Information Systems Technology Section (395)
|
Information Systems Technology Section (395)
|
||||||
Jet Propulsion Lab - Calif Institute of Technology
|
Jet Propulsion Lab - Calif Institute of Technology
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
Pixmap
|
Pixmap
|
||||||
@@ -952,7 +952,7 @@ XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
|||||||
|
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
char stipple_data[] =
|
char stipple_data[] =
|
||||||
{
|
{
|
||||||
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
||||||
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
||||||
@@ -962,21 +962,21 @@ XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
|||||||
GC gc;
|
GC gc;
|
||||||
Pixmap ipixmap, stipple;
|
Pixmap ipixmap, stipple;
|
||||||
unsigned width, height, depth;
|
unsigned width, height, depth;
|
||||||
|
|
||||||
Window window; /* These return values */
|
Window window; /* These return values */
|
||||||
unsigned border; /* from XGetGeometry() */
|
unsigned border; /* from XGetGeometry() */
|
||||||
int x, y; /* are not needed. */
|
int x, y; /* are not needed. */
|
||||||
|
|
||||||
ipixmap = 0;
|
ipixmap = 0;
|
||||||
|
|
||||||
if ( NULL == display || 0 == pixmap )
|
if ( NULL == display || 0 == pixmap )
|
||||||
return ipixmap;
|
return ipixmap;
|
||||||
|
|
||||||
if ( 0 == XGetGeometry( display, pixmap, &window, &x, &y,
|
if ( 0 == XGetGeometry( display, pixmap, &window, &x, &y,
|
||||||
&width, &height, &border, &depth )
|
&width, &height, &border, &depth )
|
||||||
)
|
)
|
||||||
return ipixmap; /* BadDrawable: probably an invalid pixmap */
|
return ipixmap; /* BadDrawable: probably an invalid pixmap */
|
||||||
|
|
||||||
/* Get the stipple pixmap to be used to 'gray-out' the argument pixmap.
|
/* Get the stipple pixmap to be used to 'gray-out' the argument pixmap.
|
||||||
*/
|
*/
|
||||||
stipple = XCreateBitmapFromData( display, pixmap, stipple_data, 16, 16 );
|
stipple = XCreateBitmapFromData( display, pixmap, stipple_data, 16, 16 );
|
||||||
@@ -994,7 +994,7 @@ XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
|||||||
*/
|
*/
|
||||||
XCopyArea( display, pixmap, ipixmap,
|
XCopyArea( display, pixmap, ipixmap,
|
||||||
gc, 0, 0, width, height, 0, 0 );
|
gc, 0, 0, width, height, 0, 0 );
|
||||||
|
|
||||||
/* Refill the new pixmap using the stipple algorithm/pixmap.
|
/* Refill the new pixmap using the stipple algorithm/pixmap.
|
||||||
*/
|
*/
|
||||||
XSetStipple( display, gc, stipple );
|
XSetStipple( display, gc, stipple );
|
||||||
@@ -1019,12 +1019,12 @@ wxBitmap wxCreateMaskedBitmap(wxBitmap& bitmap, wxColour& colour)
|
|||||||
wxMemoryDC srcDC;
|
wxMemoryDC srcDC;
|
||||||
srcDC.SelectObject(bitmap);
|
srcDC.SelectObject(bitmap);
|
||||||
destDC.SelectObject(newBitmap);
|
destDC.SelectObject(newBitmap);
|
||||||
|
|
||||||
wxBrush brush(colour, wxSOLID);
|
wxBrush brush(colour, wxSOLID);
|
||||||
destDC.SetOptimization(FALSE);
|
destDC.SetOptimization(FALSE);
|
||||||
destDC.SetBackground(brush);
|
destDC.SetBackground(brush);
|
||||||
destDC.Clear();
|
destDC.Clear();
|
||||||
destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), & srcDC, 0, 0, wxCOPY, TRUE);
|
destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), & srcDC, 0, 0, wxCOPY, TRUE);
|
||||||
|
|
||||||
return newBitmap;
|
return newBitmap;
|
||||||
}
|
}
|
||||||
|
@@ -44,35 +44,35 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
m_backgroundColour = parent->GetBackgroundColour();
|
m_backgroundColour = parent->GetBackgroundColour();
|
||||||
m_foregroundColour = parent->GetForegroundColour();
|
m_foregroundColour = parent->GetForegroundColour();
|
||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = NewControlId();
|
m_windowId = NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
char* label1 = (label.IsNull() ? "" : (char*) (const char*) label);
|
char* label1 = (label.IsNull() ? "" : (char*) (const char*) label);
|
||||||
|
|
||||||
XmString text = XmStringCreateSimple (label1);
|
XmString text = XmStringCreateSimple (label1);
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
||||||
|
|
||||||
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("toggle",
|
m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("toggle",
|
||||||
xmToggleButtonWidgetClass, parentWidget,
|
xmToggleButtonWidgetClass, parentWidget,
|
||||||
XmNfontList, fontList,
|
XmNfontList, fontList,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text,
|
||||||
NULL);
|
NULL);
|
||||||
XmStringFree (text);
|
XmStringFree (text);
|
||||||
|
|
||||||
XtAddCallback ((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc) wxCheckBoxCallback,
|
XtAddCallback ((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc) wxCheckBoxCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
|
||||||
XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
|
XmToggleButtonSetState ((Widget) m_mainWidget, FALSE, TRUE);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
SetCanAddEventHandler(TRUE);
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -105,16 +105,16 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *l
|
|||||||
SetName(name);
|
SetName(name);
|
||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = NewControlId();
|
m_windowId = NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
// TODO: Create the bitmap checkbox
|
// TODO: Create the bitmap checkbox
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,10 +143,10 @@ void wxCheckBoxCallback (Widget w, XtPointer clientData,
|
|||||||
XtPointer ptr)
|
XtPointer ptr)
|
||||||
{
|
{
|
||||||
wxCheckBox *item = (wxCheckBox *) clientData;
|
wxCheckBox *item = (wxCheckBox *) clientData;
|
||||||
|
|
||||||
if (item->InSetValue())
|
if (item->InSetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxCommandEvent event (wxEVT_COMMAND_CHECKBOX_CLICKED, item->GetId());
|
wxCommandEvent event (wxEVT_COMMAND_CHECKBOX_CLICKED, item->GetId());
|
||||||
event.SetInt((int) item->GetValue ());
|
event.SetInt((int) item->GetValue ());
|
||||||
event.SetEventObject(item);
|
event.SetEventObject(item);
|
||||||
@@ -162,14 +162,14 @@ void wxCheckBox::ChangeBackgroundColour()
|
|||||||
{
|
{
|
||||||
wxComputeColours (XtDisplay((Widget) m_mainWidget), & m_backgroundColour,
|
wxComputeColours (XtDisplay((Widget) m_mainWidget), & m_backgroundColour,
|
||||||
(wxColour*) NULL);
|
(wxColour*) NULL);
|
||||||
|
|
||||||
XtVaSetValues ((Widget) m_mainWidget,
|
XtVaSetValues ((Widget) m_mainWidget,
|
||||||
XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
|
XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
|
||||||
XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
|
XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
|
||||||
XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
|
XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
|
||||||
XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
|
XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
int selectPixel = wxBLACK->AllocColour(wxGetDisplay());
|
int selectPixel = wxBLACK->AllocColour(wxGetDisplay());
|
||||||
|
|
||||||
// Better to have the checkbox selection in black, or it's
|
// Better to have the checkbox selection in black, or it's
|
||||||
|
@@ -56,35 +56,35 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_menuWidget = (WXWidget) 0;
|
m_menuWidget = (WXWidget) 0;
|
||||||
m_widgetList = (WXWidget*) 0;
|
m_widgetList = (WXWidget*) 0;
|
||||||
m_formWidget = (WXWidget) 0;
|
m_formWidget = (WXWidget) 0;
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
m_backgroundColour = parent->GetBackgroundColour();
|
m_backgroundColour = parent->GetBackgroundColour();
|
||||||
m_foregroundColour = parent->GetForegroundColour();
|
m_foregroundColour = parent->GetForegroundColour();
|
||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
m_formWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) name,
|
m_formWidget = (WXWidget) XtVaCreateManagedWidget(name.c_str(),
|
||||||
xmRowColumnWidgetClass, parentWidget,
|
xmRowColumnWidgetClass, parentWidget,
|
||||||
XmNmarginHeight, 0,
|
XmNmarginHeight, 0,
|
||||||
XmNmarginWidth, 0,
|
XmNmarginWidth, 0,
|
||||||
XmNpacking, XmPACK_TIGHT,
|
XmNpacking, XmPACK_TIGHT,
|
||||||
XmNorientation, XmHORIZONTAL,
|
XmNorientation, XmHORIZONTAL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
XtVaSetValues ((Widget) m_formWidget, XmNspacing, 0, NULL);
|
XtVaSetValues ((Widget) m_formWidget, XmNspacing, 0, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the popup menu
|
* Create the popup menu
|
||||||
*/
|
*/
|
||||||
m_menuWidget = (WXWidget) XmCreatePulldownMenu ((Widget) m_formWidget, "choiceMenu", NULL, 0);
|
m_menuWidget = (WXWidget) XmCreatePulldownMenu ((Widget) m_formWidget, "choiceMenu", NULL, 0);
|
||||||
|
|
||||||
// int i;
|
// int i;
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
@@ -92,13 +92,13 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
Append (choices[i]);
|
Append (choices[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create button
|
* Create button
|
||||||
*/
|
*/
|
||||||
Arg args[10];
|
Arg args[10];
|
||||||
Cardinal argcnt = 0;
|
Cardinal argcnt = 0;
|
||||||
|
|
||||||
XtSetArg (args[argcnt], XmNsubMenuId, (Widget) m_menuWidget);
|
XtSetArg (args[argcnt], XmNsubMenuId, (Widget) m_menuWidget);
|
||||||
argcnt++;
|
argcnt++;
|
||||||
XtSetArg (args[argcnt], XmNmarginWidth, 0);
|
XtSetArg (args[argcnt], XmNmarginWidth, 0);
|
||||||
@@ -108,9 +108,9 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
XtSetArg (args[argcnt], XmNpacking, XmPACK_TIGHT);
|
XtSetArg (args[argcnt], XmNpacking, XmPACK_TIGHT);
|
||||||
argcnt++;
|
argcnt++;
|
||||||
m_buttonWidget = (WXWidget) XmCreateOptionMenu ((Widget) m_formWidget, "choiceButton", args, argcnt);
|
m_buttonWidget = (WXWidget) XmCreateOptionMenu ((Widget) m_formWidget, "choiceButton", args, argcnt);
|
||||||
|
|
||||||
m_mainWidget = m_buttonWidget;
|
m_mainWidget = m_buttonWidget;
|
||||||
|
|
||||||
XtManageChild ((Widget) m_buttonWidget);
|
XtManageChild ((Widget) m_buttonWidget);
|
||||||
|
|
||||||
// New code from Roland Haenel (roland_haenel@ac.cybercity.de)
|
// New code from Roland Haenel (roland_haenel@ac.cybercity.de)
|
||||||
@@ -128,13 +128,13 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
|
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
|
||||||
|
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
|
|
||||||
AttachWidget (parent, m_buttonWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_buttonWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,15 +147,15 @@ wxChoice::~wxChoice()
|
|||||||
// XtDestroyWidget (menuWidget);
|
// XtDestroyWidget (menuWidget);
|
||||||
if (m_widgetList)
|
if (m_widgetList)
|
||||||
delete[] m_widgetList;
|
delete[] m_widgetList;
|
||||||
|
|
||||||
if (GetMainWidget())
|
if (GetMainWidget())
|
||||||
{
|
{
|
||||||
DetachWidget(GetMainWidget()); // Removes event handlers
|
DetachWidget(GetMainWidget()); // Removes event handlers
|
||||||
DetachWidget(m_formWidget);
|
DetachWidget(m_formWidget);
|
||||||
|
|
||||||
XtDestroyWidget((Widget) m_formWidget);
|
XtDestroyWidget((Widget) m_formWidget);
|
||||||
m_formWidget = (WXWidget) 0;
|
m_formWidget = (WXWidget) 0;
|
||||||
|
|
||||||
// Presumably the other widgets have been deleted now, via the form
|
// Presumably the other widgets have been deleted now, via the form
|
||||||
m_mainWidget = (WXWidget) 0;
|
m_mainWidget = (WXWidget) 0;
|
||||||
m_buttonWidget = (WXWidget) 0;
|
m_buttonWidget = (WXWidget) 0;
|
||||||
@@ -164,40 +164,39 @@ wxChoice::~wxChoice()
|
|||||||
|
|
||||||
void wxChoice::Append(const wxString& item)
|
void wxChoice::Append(const wxString& item)
|
||||||
{
|
{
|
||||||
wxStripMenuCodes ((char *)(const char *)item, wxBuffer);
|
Widget w = XtVaCreateManagedWidget (wxStripMenuCodes(item),
|
||||||
Widget w = XtVaCreateManagedWidget (wxBuffer,
|
|
||||||
#if USE_GADGETS
|
#if USE_GADGETS
|
||||||
xmPushButtonGadgetClass, (Widget) m_menuWidget,
|
xmPushButtonGadgetClass, (Widget) m_menuWidget,
|
||||||
#else
|
#else
|
||||||
xmPushButtonWidgetClass, (Widget) m_menuWidget,
|
xmPushButtonWidgetClass, (Widget) m_menuWidget,
|
||||||
#endif
|
#endif
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
DoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
|
DoChangeBackgroundColour((WXWidget) w, m_backgroundColour);
|
||||||
|
|
||||||
if (m_font.Ok())
|
if (m_font.Ok())
|
||||||
XtVaSetValues (w,
|
XtVaSetValues (w,
|
||||||
XmNfontList, (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_formWidget)),
|
XmNfontList, (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_formWidget)),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
WXWidget *new_widgetList = new WXWidget[m_noStrings + 1];
|
WXWidget *new_widgetList = new WXWidget[m_noStrings + 1];
|
||||||
int i;
|
int i;
|
||||||
if (m_widgetList)
|
if (m_widgetList)
|
||||||
for (i = 0; i < m_noStrings; i++)
|
for (i = 0; i < m_noStrings; i++)
|
||||||
new_widgetList[i] = m_widgetList[i];
|
new_widgetList[i] = m_widgetList[i];
|
||||||
|
|
||||||
new_widgetList[m_noStrings] = (WXWidget) w;
|
new_widgetList[m_noStrings] = (WXWidget) w;
|
||||||
|
|
||||||
if (m_widgetList)
|
if (m_widgetList)
|
||||||
delete[] m_widgetList;
|
delete[] m_widgetList;
|
||||||
m_widgetList = new_widgetList;
|
m_widgetList = new_widgetList;
|
||||||
|
|
||||||
char mnem = wxFindMnemonic ((char*) (const char*) item);
|
char mnem = wxFindMnemonic ((char*) (const char*) item);
|
||||||
if (mnem != 0)
|
if (mnem != 0)
|
||||||
XtVaSetValues (w, XmNmnemonic, mnem, NULL);
|
XtVaSetValues (w, XmNmnemonic, mnem, NULL);
|
||||||
|
|
||||||
XtAddCallback (w, XmNactivateCallback, (XtCallbackProc) wxChoiceCallback, (XtPointer) this);
|
XtAddCallback (w, XmNactivateCallback, (XtCallbackProc) wxChoiceCallback, (XtPointer) this);
|
||||||
|
|
||||||
if (m_noStrings == 0 && m_buttonWidget)
|
if (m_noStrings == 0 && m_buttonWidget)
|
||||||
{
|
{
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNmenuHistory, w, NULL);
|
XtVaSetValues ((Widget) m_buttonWidget, XmNmenuHistory, w, NULL);
|
||||||
@@ -210,18 +209,18 @@ void wxChoice::Append(const wxString& item)
|
|||||||
}
|
}
|
||||||
wxNode *node = m_stringList.Add (item);
|
wxNode *node = m_stringList.Add (item);
|
||||||
XtVaSetValues (w, XmNuserData, node->Data (), NULL);
|
XtVaSetValues (w, XmNuserData, node->Data (), NULL);
|
||||||
|
|
||||||
m_noStrings ++;
|
m_noStrings ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Delete(int WXUNUSED(n))
|
void wxChoice::Delete(int WXUNUSED(n))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( "Sorry, wxChoice::Delete isn't implemented yet. Maybe you'd like to volunteer? :-)" );
|
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,
|
// 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
|
// delete the m_stringList entry, delete the button widget, construct a new widget list
|
||||||
// (see Append)
|
// (see Append)
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
m_noStrings --;
|
m_noStrings --;
|
||||||
}
|
}
|
||||||
@@ -251,7 +250,7 @@ int wxChoice::GetSelection() const
|
|||||||
XtVaGetValues (label,
|
XtVaGetValues (label,
|
||||||
XmNlabelString, &text,
|
XmNlabelString, &text,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -267,7 +266,7 @@ int wxChoice::GetSelection() const
|
|||||||
else
|
else
|
||||||
i++;
|
i++;
|
||||||
} // for()
|
} // for()
|
||||||
|
|
||||||
XmStringFree(text) ;
|
XmStringFree(text) ;
|
||||||
XtFree (s);
|
XtFree (s);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -279,12 +278,12 @@ int wxChoice::GetSelection() const
|
|||||||
void wxChoice::SetSelection(int n)
|
void wxChoice::SetSelection(int n)
|
||||||
{
|
{
|
||||||
m_inSetValue = TRUE;
|
m_inSetValue = TRUE;
|
||||||
|
|
||||||
wxNode *node = m_stringList.Nth (n);
|
wxNode *node = m_stringList.Nth (n);
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
Dimension selectionWidth, selectionHeight;
|
Dimension selectionWidth, selectionHeight;
|
||||||
|
|
||||||
char *s = (char *) node->Data ();
|
char *s = (char *) node->Data ();
|
||||||
XmString text = XmStringCreateSimple (s);
|
XmString text = XmStringCreateSimple (s);
|
||||||
XtVaGetValues ((Widget) m_widgetList[n], XmNwidth, &selectionWidth, XmNheight, &selectionHeight, NULL);
|
XtVaGetValues ((Widget) m_widgetList[n], XmNwidth, &selectionWidth, XmNheight, &selectionHeight, NULL);
|
||||||
@@ -328,10 +327,10 @@ wxString wxChoice::GetString(int n) const
|
|||||||
void wxChoice::SetColumns(int n)
|
void wxChoice::SetColumns(int n)
|
||||||
{
|
{
|
||||||
if (n<1) n = 1 ;
|
if (n<1) n = 1 ;
|
||||||
|
|
||||||
short numColumns = n ;
|
short numColumns = n ;
|
||||||
Arg args[3];
|
Arg args[3];
|
||||||
|
|
||||||
XtSetArg(args[0], XmNnumColumns, numColumns);
|
XtSetArg(args[0], XmNnumColumns, numColumns);
|
||||||
XtSetArg(args[1], XmNpacking, XmPACK_COLUMN);
|
XtSetArg(args[1], XmNpacking, XmPACK_COLUMN);
|
||||||
XtSetValues((Widget) m_menuWidget,args,2) ;
|
XtSetValues((Widget) m_menuWidget,args,2) ;
|
||||||
@@ -340,7 +339,7 @@ void wxChoice::SetColumns(int n)
|
|||||||
int wxChoice::GetColumns(void) const
|
int wxChoice::GetColumns(void) const
|
||||||
{
|
{
|
||||||
short numColumns ;
|
short numColumns ;
|
||||||
|
|
||||||
XtVaGetValues((Widget) m_menuWidget,XmNnumColumns,&numColumns,NULL) ;
|
XtVaGetValues((Widget) m_menuWidget,XmNnumColumns,&numColumns,NULL) ;
|
||||||
return numColumns ;
|
return numColumns ;
|
||||||
}
|
}
|
||||||
@@ -354,12 +353,12 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
{
|
{
|
||||||
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_ANY, NULL);
|
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_ANY, NULL);
|
||||||
bool managed = XtIsManaged((Widget) m_formWidget);
|
bool managed = XtIsManaged((Widget) m_formWidget);
|
||||||
|
|
||||||
if (managed)
|
if (managed)
|
||||||
XtUnmanageChild ((Widget) m_formWidget);
|
XtUnmanageChild ((Widget) m_formWidget);
|
||||||
|
|
||||||
int actualWidth = width, actualHeight = height;
|
int actualWidth = width, actualHeight = height;
|
||||||
|
|
||||||
if (width > -1)
|
if (width > -1)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -376,11 +375,11 @@ void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNheight, actualHeight,
|
XtVaSetValues ((Widget) m_buttonWidget, XmNheight, actualHeight,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (managed)
|
if (managed)
|
||||||
XtManageChild ((Widget) m_formWidget);
|
XtManageChild ((Widget) m_formWidget);
|
||||||
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
|
XtVaSetValues((Widget) m_formWidget, XmNresizePolicy, XmRESIZE_NONE, NULL);
|
||||||
|
|
||||||
wxControl::DoSetSize (x, y, width, height, sizeFlags);
|
wxControl::DoSetSize (x, y, width, height, sizeFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,7 +417,7 @@ void wxChoiceCallback (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr))
|
|||||||
{
|
{
|
||||||
if (item->InSetValue())
|
if (item->InSetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
XtVaGetValues (w, XmNuserData, &s, NULL);
|
XtVaGetValues (w, XmNuserData, &s, NULL);
|
||||||
if (s)
|
if (s)
|
||||||
@@ -441,11 +440,11 @@ void wxChoice::ChangeFont(bool keepOriginalSize)
|
|||||||
{
|
{
|
||||||
int width, height, width1, height1;
|
int width, height, width1, height1;
|
||||||
GetSize(& width, & height);
|
GetSize(& width, & height);
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_mainWidget));
|
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_mainWidget));
|
||||||
XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL);
|
XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL);
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);
|
XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);
|
||||||
|
|
||||||
/* TODO: why does this cause a crash in XtWidgetToApplicationContext?
|
/* TODO: why does this cause a crash in XtWidgetToApplicationContext?
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_noStrings; i++)
|
for (i = 0; i < m_noStrings; i++)
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -43,17 +43,17 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
// m_backgroundColour = parent->GetBackgroundColour();
|
// m_backgroundColour = parent->GetBackgroundColour();
|
||||||
m_backgroundColour = * wxWHITE;
|
m_backgroundColour = * wxWHITE;
|
||||||
m_foregroundColour = parent->GetForegroundColour();
|
m_foregroundColour = parent->GetForegroundColour();
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
Widget buttonWidget = XtVaCreateManagedWidget((char*) (const char*) name,
|
Widget buttonWidget = XtVaCreateManagedWidget(name.c_str(),
|
||||||
xmComboBoxWidgetClass, parentWidget,
|
xmComboBoxWidgetClass, parentWidget,
|
||||||
XmNmarginHeight, 0,
|
XmNmarginHeight, 0,
|
||||||
XmNmarginWidth, 0,
|
XmNmarginWidth, 0,
|
||||||
@@ -62,12 +62,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
XmNsorted, ((style & wxCB_SORT) == wxCB_SORT),
|
XmNsorted, ((style & wxCB_SORT) == wxCB_SORT),
|
||||||
XmNstaticList, ((style & wxCB_SIMPLE) == wxCB_SIMPLE),
|
XmNstaticList, ((style & wxCB_SIMPLE) == wxCB_SIMPLE),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
XtAddCallback (buttonWidget, XmNselectionCallback, (XtCallbackProc) wxComboBoxCallback,
|
XtAddCallback (buttonWidget, XmNselectionCallback, (XtCallbackProc) wxComboBoxCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
XtAddCallback (buttonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxComboBoxCallback,
|
XtAddCallback (buttonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxComboBoxCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
@@ -77,21 +77,21 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_stringList.Add(choices[i]);
|
m_stringList.Add(choices[i]);
|
||||||
}
|
}
|
||||||
m_noStrings = n;
|
m_noStrings = n;
|
||||||
|
|
||||||
m_mainWidget = (Widget) buttonWidget;
|
m_mainWidget = (Widget) buttonWidget;
|
||||||
|
|
||||||
XtManageChild (buttonWidget);
|
XtManageChild (buttonWidget);
|
||||||
|
|
||||||
SetValue(value);
|
SetValue(value);
|
||||||
|
|
||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
SetCanAddEventHandler(TRUE);
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,16 +207,16 @@ int wxComboBox::FindString(const wxString& s) const
|
|||||||
XmString text = XmStringCreateSimple ((char*) (const char*) s);
|
XmString text = XmStringCreateSimple ((char*) (const char*) s);
|
||||||
bool found = (XmComboBoxGetMatchPos((Widget) m_mainWidget,
|
bool found = (XmComboBoxGetMatchPos((Widget) m_mainWidget,
|
||||||
text, &pos_list, &count) != 0);
|
text, &pos_list, &count) != 0);
|
||||||
|
|
||||||
XmStringFree(text);
|
XmStringFree(text);
|
||||||
|
|
||||||
if (found && count > 0)
|
if (found && count > 0)
|
||||||
{
|
{
|
||||||
int pos = pos_list[0] - 1;
|
int pos = pos_list[0] - 1;
|
||||||
free(pos_list);
|
free(pos_list);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,21 +271,21 @@ void wxComboBox::Replace(long from, long to, const wxString& value)
|
|||||||
void wxComboBox::Remove(long from, long to)
|
void wxComboBox::Remove(long from, long to)
|
||||||
{
|
{
|
||||||
XmComboBoxSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
|
XmComboBoxSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
|
||||||
(Time) 0);
|
(Time) 0);
|
||||||
XmComboBoxRemove ((Widget) m_mainWidget);
|
XmComboBoxRemove ((Widget) m_mainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboBox::SetSelection(long from, long to)
|
void wxComboBox::SetSelection(long from, long to)
|
||||||
{
|
{
|
||||||
XmComboBoxSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
|
XmComboBoxSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
|
||||||
(Time) 0);
|
(Time) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
|
void wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
|
||||||
XmComboBoxSelectionCallbackStruct * cbs)
|
XmComboBoxSelectionCallbackStruct * cbs)
|
||||||
{
|
{
|
||||||
wxComboBox *item = (wxComboBox *) clientData;
|
wxComboBox *item = (wxComboBox *) clientData;
|
||||||
|
|
||||||
switch (cbs->reason)
|
switch (cbs->reason)
|
||||||
{
|
{
|
||||||
case XmCR_SINGLE_SELECT:
|
case XmCR_SINGLE_SELECT:
|
||||||
@@ -293,7 +293,7 @@ void wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
|
|||||||
{
|
{
|
||||||
wxCommandEvent event (wxEVT_COMMAND_COMBOBOX_SELECTED, item->GetId());
|
wxCommandEvent event (wxEVT_COMMAND_COMBOBOX_SELECTED, item->GetId());
|
||||||
event.m_commandInt = cbs->index - 1;
|
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.m_extraLong = TRUE;
|
||||||
event.SetEventObject(item);
|
event.SetEventObject(item);
|
||||||
item->ProcessCommand (event);
|
item->ProcessCommand (event);
|
||||||
@@ -303,7 +303,7 @@ void wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
|
|||||||
{
|
{
|
||||||
wxCommandEvent event (wxEVT_COMMAND_TEXT_UPDATED, item->GetId());
|
wxCommandEvent event (wxEVT_COMMAND_TEXT_UPDATED, item->GetId());
|
||||||
event.m_commandInt = -1;
|
event.m_commandInt = -1;
|
||||||
// event.m_commandString = item->GetValue();
|
// event.m_commandString = item->GetValue();
|
||||||
event.m_extraLong = TRUE;
|
event.m_extraLong = TRUE;
|
||||||
event.SetEventObject(item);
|
event.SetEventObject(item);
|
||||||
item->ProcessCommand (event);
|
item->ProcessCommand (event);
|
||||||
|
@@ -31,7 +31,11 @@ wxControl::wxControl()
|
|||||||
{
|
{
|
||||||
m_backgroundColour = *wxWHITE;
|
m_backgroundColour = *wxWHITE;
|
||||||
m_foregroundColour = *wxBLACK;
|
m_foregroundColour = *wxBLACK;
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY
|
||||||
m_callback = 0;
|
m_callback = 0;
|
||||||
|
#endif // WXWIN_COMPATIBILITY
|
||||||
|
|
||||||
m_inSetValue = FALSE;
|
m_inSetValue = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,43 +93,17 @@ wxString wxControl::GetLabel() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxControl::ProcessCommand (wxCommandEvent & event)
|
bool wxControl::ProcessCommand(wxCommandEvent & event)
|
||||||
{
|
{
|
||||||
// Tries:
|
#if WXWIN_COMPATIBILITY
|
||||||
// 1) A callback function (to become obsolete)
|
if ( m_callback )
|
||||||
// 2) OnCommand, starting at this window and working up parent hierarchy
|
|
||||||
// 3) OnCommand then calls ProcessEvent to search the event tables.
|
|
||||||
if (m_callback)
|
|
||||||
{
|
{
|
||||||
(void) (*(m_callback)) (*this, event);
|
(void)(*m_callback)(this, event);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
#endif // WXWIN_COMPATIBILITY
|
||||||
GetEventHandler()->OnCommand(*this, event);
|
|
||||||
}
|
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
|
wxList wxModelessWindows; // Frames and modeless dialogs
|
||||||
extern wxList wxPendingDelete;
|
extern wxList wxPendingDelete;
|
||||||
|
|
||||||
extern wxHashTable *wxWidgetHashTable;
|
|
||||||
|
|
||||||
#define wxUSE_INVISIBLE_RESIZE 1
|
#define wxUSE_INVISIBLE_RESIZE 1
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
|
@@ -50,8 +50,6 @@
|
|||||||
|
|
||||||
#include "wx/motif/private.h"
|
#include "wx/motif/private.h"
|
||||||
|
|
||||||
extern wxHashTable *wxWidgetHashTable;
|
|
||||||
|
|
||||||
void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
|
void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
|
||||||
void wxFrameFocusProc(Widget workArea, XtPointer clientData,
|
void wxFrameFocusProc(Widget workArea, XtPointer clientData,
|
||||||
XmAnyCallbackStruct *cbs);
|
XmAnyCallbackStruct *cbs);
|
||||||
@@ -150,8 +148,18 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
int width = size.x; int height = size.y;
|
int width = size.x; int height = size.y;
|
||||||
|
|
||||||
if (wxTopLevelUsed)
|
if (wxTopLevelUsed)
|
||||||
|
{
|
||||||
// Change suggested by Matthew Flatt
|
// 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
|
else
|
||||||
{
|
{
|
||||||
m_frameShell = wxTheApp->GetTopLevelWidget();
|
m_frameShell = wxTheApp->GetTopLevelWidget();
|
||||||
@@ -192,6 +200,9 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
// XmNresizePolicy, XmRESIZE_ANY,
|
// XmNresizePolicy, XmRESIZE_ANY,
|
||||||
NULL);
|
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,
|
XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE,
|
||||||
wxUniversalRepaintProc, (XtPointer) this);
|
wxUniversalRepaintProc, (XtPointer) this);
|
||||||
|
|
||||||
@@ -202,9 +213,6 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
XtManageChild((Widget) m_clientArea);
|
XtManageChild((Widget) m_clientArea);
|
||||||
XtManageChild((Widget) m_workArea);
|
XtManageChild((Widget) m_workArea);
|
||||||
|
|
||||||
wxASSERT_MSG( !wxGetWindowFromTable((Widget)m_workArea),
|
|
||||||
"Widget table clash in frame.cpp") ;
|
|
||||||
|
|
||||||
wxAddWindowToTable((Widget) m_workArea, this);
|
wxAddWindowToTable((Widget) m_workArea, this);
|
||||||
|
|
||||||
XtTranslations ptr ;
|
XtTranslations ptr ;
|
||||||
|
@@ -43,7 +43,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
|
|||||||
* indirect or consequential damages or any damages
|
* indirect or consequential damages or any damages
|
||||||
* whatsoever resulting from loss of use, data or profits,
|
* whatsoever resulting from loss of use, data or profits,
|
||||||
* whether in an action of contract, negligence or other tortious
|
* 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.
|
* or performance of this software.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -87,16 +87,16 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_backgroundColour = parent->GetBackgroundColour();
|
m_backgroundColour = parent->GetBackgroundColour();
|
||||||
m_foregroundColour = parent->GetForegroundColour();
|
m_foregroundColour = parent->GetForegroundColour();
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
Arg args[4];
|
Arg args[4];
|
||||||
int count = 4;
|
int count = 4;
|
||||||
if (style & wxHORIZONTAL)
|
if (style & wxHORIZONTAL)
|
||||||
@@ -113,24 +113,24 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
|
|||||||
XtSetArg(args[3], XmNmaximum, range);
|
XtSetArg(args[3], XmNmaximum, range);
|
||||||
Widget gaugeWidget = XtCreateManagedWidget("gauge", xmGaugeWidgetClass, parentWidget, args, count);
|
Widget gaugeWidget = XtCreateManagedWidget("gauge", xmGaugeWidgetClass, parentWidget, args, count);
|
||||||
m_mainWidget = (WXWidget) gaugeWidget ;
|
m_mainWidget = (WXWidget) gaugeWidget ;
|
||||||
|
|
||||||
XtManageChild (gaugeWidget);
|
XtManageChild (gaugeWidget);
|
||||||
|
|
||||||
int x = pos.x; int y = pos.y;
|
int x = pos.x; int y = pos.y;
|
||||||
int width = size.x; int height = size.y;
|
int width = size.x; int height = size.y;
|
||||||
if (width == -1)
|
if (width == -1)
|
||||||
width = 150;
|
width = 150;
|
||||||
if (height == -1)
|
if (height == -1)
|
||||||
height = 80;
|
height = 80;
|
||||||
|
|
||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
SetCanAddEventHandler(TRUE);
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, x, y, width, height);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ typedef struct {
|
|||||||
int empty;
|
int empty;
|
||||||
} XmGaugeClassPart;
|
} XmGaugeClassPart;
|
||||||
|
|
||||||
typedef struct _XmGaugeClassRec {
|
typedef struct _XmGaugeClassRec {
|
||||||
CoreClassPart core_class;
|
CoreClassPart core_class;
|
||||||
XmPrimitiveClassPart primitive_class;
|
XmPrimitiveClassPart primitive_class;
|
||||||
XmGaugeClassPart gauge_class;
|
XmGaugeClassPart gauge_class;
|
||||||
@@ -222,10 +222,10 @@ typedef struct _XmGaugePart{
|
|||||||
int maximum;
|
int maximum;
|
||||||
unsigned char orientation;
|
unsigned char orientation;
|
||||||
unsigned char processingDirection;
|
unsigned char processingDirection;
|
||||||
|
|
||||||
XtCallbackList dragCallback;
|
XtCallbackList dragCallback;
|
||||||
XtCallbackList valueChangedCallback;
|
XtCallbackList valueChangedCallback;
|
||||||
|
|
||||||
/* private fields */
|
/* private fields */
|
||||||
Boolean dragging; /* drag in progress ? */
|
Boolean dragging; /* drag in progress ? */
|
||||||
int oldx, oldy;
|
int oldx, oldy;
|
||||||
@@ -247,9 +247,9 @@ extern XmGaugeClassRec xmGaugeClassRec;
|
|||||||
|
|
||||||
void
|
void
|
||||||
GaugePick(Widget w, XEvent *e, String *args, Cardinal *num_args);
|
GaugePick(Widget w, XEvent *e, String *args, Cardinal *num_args);
|
||||||
void
|
void
|
||||||
GaugeDrag(Widget w, XEvent *e, String *args, Cardinal *num_args);
|
GaugeDrag(Widget w, XEvent *e, String *args, Cardinal *num_args);
|
||||||
void
|
void
|
||||||
GaugeDrop(Widget w, XEvent *e, String *args, Cardinal *num_args);
|
GaugeDrop(Widget w, XEvent *e, String *args, Cardinal *num_args);
|
||||||
|
|
||||||
|
|
||||||
@@ -280,9 +280,9 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
unsigned long backgr,foregr;
|
unsigned long backgr,foregr;
|
||||||
XRectangle rects[1];
|
XRectangle rects[1];
|
||||||
***/
|
***/
|
||||||
|
|
||||||
sht = gw->primitive.shadow_thickness;
|
sht = gw->primitive.shadow_thickness;
|
||||||
|
|
||||||
ratio = (float)THIS.value/
|
ratio = (float)THIS.value/
|
||||||
(float)(THIS.maximum - THIS.minimum);
|
(float)(THIS.maximum - THIS.minimum);
|
||||||
/***chubraev
|
/***chubraev
|
||||||
@@ -290,7 +290,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
len=strlen(string);
|
len=strlen(string);
|
||||||
XtVaGetValues(gw,XmNbackground,&backgr,XmNforeground,&foregr,NULL);
|
XtVaGetValues(gw,XmNbackground,&backgr,XmNforeground,&foregr,NULL);
|
||||||
***/
|
***/
|
||||||
|
|
||||||
if(clear) {
|
if(clear) {
|
||||||
XClearArea(XtDisplay(gw), XtWindow(gw), sht, sht,
|
XClearArea(XtDisplay(gw), XtWindow(gw), sht, sht,
|
||||||
gw->core.width - 2 * sht, gw->core.height - 2 * sht, False);
|
gw->core.width - 2 * sht, gw->core.height - 2 * sht, False);
|
||||||
@@ -299,7 +299,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
case XmHORIZONTAL:
|
case XmHORIZONTAL:
|
||||||
size = (int) ((gw->core.width - 2 * sht)*ratio);
|
size = (int) ((gw->core.width - 2 * sht)*ratio);
|
||||||
/***chubraev
|
/***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);
|
gw->core.height - 2 * sht, string, len);
|
||||||
***/
|
***/
|
||||||
switch(THIS.processingDirection) {
|
switch(THIS.processingDirection) {
|
||||||
@@ -307,7 +307,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
case XmMAX_ON_BOTTOM:
|
case XmMAX_ON_BOTTOM:
|
||||||
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
|
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
|
||||||
sht, sht, size, gw->core.height - 2 * sht);
|
sht, sht, size, gw->core.height - 2 * sht);
|
||||||
|
|
||||||
/***chubraev
|
/***chubraev
|
||||||
rects[0].x = sht; rects[0].y = sht;
|
rects[0].x = sht; rects[0].y = sht;
|
||||||
rects[0].width = size; rects[0].height = gw->core.height - 2 * sht;
|
rects[0].width = size; rects[0].height = gw->core.height - 2 * sht;
|
||||||
@@ -318,7 +318,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
|
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
|
||||||
gw->core.width - size - sht, sht,
|
gw->core.width - size - sht, sht,
|
||||||
size, gw->core.height - 2 * sht);
|
size, gw->core.height - 2 * sht);
|
||||||
|
|
||||||
/***chubraev
|
/***chubraev
|
||||||
rects[0].x = gw->core.width - size - sht; rects[0].y = sht;
|
rects[0].x = gw->core.width - size - sht; rects[0].y = sht;
|
||||||
rects[0].width = size; rects[0].height = gw->core.height - 2 * sht;
|
rects[0].width = size; rects[0].height = gw->core.height - 2 * sht;
|
||||||
@@ -328,15 +328,15 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
/***chubraev
|
/***chubraev
|
||||||
XSetClipRectangles(XtDisplay(gw), THIS.gc, 0, 0, rects, 1, Unsorted);
|
XSetClipRectangles(XtDisplay(gw), THIS.gc, 0, 0, rects, 1, Unsorted);
|
||||||
XSetForeground(XtDisplay(gw), THIS.gc, backgr);
|
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);
|
gw->core.height - 2 * sht, string, len);
|
||||||
***/
|
***/
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case XmVERTICAL:
|
case XmVERTICAL:
|
||||||
size = (int) ((gw->core.height - 2 * sht)*ratio);
|
size = (int) ((gw->core.height - 2 * sht)*ratio);
|
||||||
/***chubraev
|
/***chubraev
|
||||||
XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht,
|
XDrawString(XtDisplay(gw), XtWindow(gw), THIS.gc, sht,
|
||||||
sht+gw->core.height/2, string,len);
|
sht+gw->core.height/2, string,len);
|
||||||
***/
|
***/
|
||||||
switch(THIS.processingDirection) {
|
switch(THIS.processingDirection) {
|
||||||
@@ -344,7 +344,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
case XmMAX_ON_BOTTOM:
|
case XmMAX_ON_BOTTOM:
|
||||||
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
|
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
|
||||||
sht, sht, gw->core.width - 2 * sht, size);
|
sht, sht, gw->core.width - 2 * sht, size);
|
||||||
|
|
||||||
/***chubraev
|
/***chubraev
|
||||||
rects[0].x = sht; rects[0].y = sht;
|
rects[0].x = sht; rects[0].y = sht;
|
||||||
rects[0].width = gw->core.width - 2 * sht; rects[0].height = size;
|
rects[0].width = gw->core.width - 2 * sht; rects[0].height = size;
|
||||||
@@ -355,7 +355,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
|
XFillRectangle(XtDisplay(gw), XtWindow(gw), THIS.gc,
|
||||||
sht, gw->core.height - size - sht,
|
sht, gw->core.height - size - sht,
|
||||||
gw->core.width - 2 * sht, size);
|
gw->core.width - 2 * sht, size);
|
||||||
|
|
||||||
/***chubraev
|
/***chubraev
|
||||||
rects[0].x = sht; rects[0].y = gw->core.height - size - sht;
|
rects[0].x = sht; rects[0].y = gw->core.height - size - sht;
|
||||||
rects[0].width = gw->core.width - 2 * sht; rects[0].height = size;
|
rects[0].width = gw->core.width - 2 * sht; rects[0].height = size;
|
||||||
@@ -364,7 +364,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
/***chubraev
|
/***chubraev
|
||||||
XSetClipRectangles(XtDisplay(gw), THIS.gc, 0, 0, rects, 1, Unsorted);
|
XSetClipRectangles(XtDisplay(gw), THIS.gc, 0, 0, rects, 1, Unsorted);
|
||||||
XSetForeground(XtDisplay(gw), THIS.gc, backgr);
|
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);
|
sht+gw->core.height/2, string,len);
|
||||||
***/
|
***/
|
||||||
break;
|
break;
|
||||||
@@ -373,7 +373,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
XSetClipMask(XtDisplay(gw), THIS.gc, None);
|
XSetClipMask(XtDisplay(gw), THIS.gc, None);
|
||||||
XSetForeground(XtDisplay(gw), THIS.gc, foregr);
|
XSetForeground(XtDisplay(gw), THIS.gc, foregr);
|
||||||
***/
|
***/
|
||||||
#undef THIS
|
#undef THIS
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Old code
|
/* Old code
|
||||||
@@ -385,7 +385,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
#define THIS gw->gauge
|
#define THIS gw->gauge
|
||||||
int size, sht;
|
int size, sht;
|
||||||
/* float ratio; */
|
/* float ratio; */
|
||||||
|
|
||||||
sht = gw->primitive.shadow_thickness;
|
sht = gw->primitive.shadow_thickness;
|
||||||
/* See fix comment below: can cause divide by zero error.
|
/* See fix comment below: can cause divide by zero error.
|
||||||
ratio = (float)((float)THIS.maximum -
|
ratio = (float)((float)THIS.maximum -
|
||||||
@@ -431,7 +431,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#undef THIS
|
#undef THIS
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -441,12 +441,12 @@ Initialize(Widget req, Widget new_w, ArgList args, Cardinal *num_args )
|
|||||||
XmGaugeWidget gw = (XmGaugeWidget)new_w;
|
XmGaugeWidget gw = (XmGaugeWidget)new_w;
|
||||||
#define THIS gw->gauge
|
#define THIS gw->gauge
|
||||||
XGCValues values;
|
XGCValues values;
|
||||||
|
|
||||||
values.foreground = gw->primitive.foreground;
|
values.foreground = gw->primitive.foreground;
|
||||||
THIS.gc = XtGetGC(new_w, GCForeground, &values);
|
THIS.gc = XtGetGC(new_w, GCForeground, &values);
|
||||||
|
|
||||||
#undef THIS
|
#undef THIS
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -457,7 +457,7 @@ Destroy(Widget w)
|
|||||||
XmGaugeWidget gw = (XmGaugeWidget)w;
|
XmGaugeWidget gw = (XmGaugeWidget)w;
|
||||||
#define THIS gw->gauge
|
#define THIS gw->gauge
|
||||||
XtReleaseGC(w, THIS.gc);
|
XtReleaseGC(w, THIS.gc);
|
||||||
#undef THIS
|
#undef THIS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -473,11 +473,11 @@ SetValues(
|
|||||||
{
|
{
|
||||||
XmGaugeWidget cgw = (XmGaugeWidget)cw;
|
XmGaugeWidget cgw = (XmGaugeWidget)cw;
|
||||||
XmGaugeWidget ngw = (XmGaugeWidget)nw;
|
XmGaugeWidget ngw = (XmGaugeWidget)nw;
|
||||||
|
|
||||||
Boolean redraw = False;
|
Boolean redraw = False;
|
||||||
if(cgw->primitive.foreground != ngw->primitive.foreground) {
|
if(cgw->primitive.foreground != ngw->primitive.foreground) {
|
||||||
XGCValues values;
|
XGCValues values;
|
||||||
|
|
||||||
redraw = True;
|
redraw = True;
|
||||||
XtReleaseGC(nw, ngw->gauge.gc);
|
XtReleaseGC(nw, ngw->gauge.gc);
|
||||||
values.foreground = ngw->primitive.foreground;
|
values.foreground = ngw->primitive.foreground;
|
||||||
@@ -498,7 +498,7 @@ ExposeProc(Widget w, XEvent *event, Region r)
|
|||||||
XmGaugeWidget gw = (XmGaugeWidget)w;
|
XmGaugeWidget gw = (XmGaugeWidget)w;
|
||||||
#define THIS gw->gauge
|
#define THIS gw->gauge
|
||||||
int sht;
|
int sht;
|
||||||
|
|
||||||
sht = gw->primitive.shadow_thickness;
|
sht = gw->primitive.shadow_thickness;
|
||||||
_XmDrawShadows(XtDisplay(w), XtWindow(w),
|
_XmDrawShadows(XtDisplay(w), XtWindow(w),
|
||||||
gw->primitive.top_shadow_GC,
|
gw->primitive.top_shadow_GC,
|
||||||
@@ -506,39 +506,39 @@ ExposeProc(Widget w, XEvent *event, Region r)
|
|||||||
0, 0, w->core.width, w->core.height,
|
0, 0, w->core.width, w->core.height,
|
||||||
sht, XmSHADOW_IN);
|
sht, XmSHADOW_IN);
|
||||||
DrawSlider(gw, False);
|
DrawSlider(gw, False);
|
||||||
#undef THIS
|
#undef THIS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static XtResource
|
static XtResource
|
||||||
resources[] = {
|
resources[] = {
|
||||||
#define offset(field) XtOffset(XmGaugeWidget, gauge.field)
|
#define offset(field) XtOffset(XmGaugeWidget, gauge.field)
|
||||||
{XmNvalue, XmCValue, XtRInt, sizeof(int),
|
{XmNvalue, XmCValue, XtRInt, sizeof(int),
|
||||||
offset(value), XtRImmediate, (caddr_t)10},
|
offset(value), XtRImmediate, (caddr_t)10},
|
||||||
|
|
||||||
{XmNminimum, XmCValue, XtRInt, sizeof(int),
|
{XmNminimum, XmCValue, XtRInt, sizeof(int),
|
||||||
offset(minimum), XtRImmediate, (caddr_t)0},
|
offset(minimum), XtRImmediate, (caddr_t)0},
|
||||||
|
|
||||||
{XmNmaximum, XmCValue, XtRInt, sizeof(int),
|
{XmNmaximum, XmCValue, XtRInt, sizeof(int),
|
||||||
offset(maximum), XtRImmediate, (caddr_t)100},
|
offset(maximum), XtRImmediate, (caddr_t)100},
|
||||||
|
|
||||||
{XmNorientation, XmCOrientation, XmROrientation, sizeof(unsigned char),
|
{XmNorientation, XmCOrientation, XmROrientation, sizeof(unsigned char),
|
||||||
offset(orientation), XtRImmediate, (caddr_t)XmVERTICAL},
|
offset(orientation), XtRImmediate, (caddr_t)XmVERTICAL},
|
||||||
|
|
||||||
{XmNprocessingDirection, XmCProcessingDirection,
|
{XmNprocessingDirection, XmCProcessingDirection,
|
||||||
XmRProcessingDirection, sizeof(unsigned char),
|
XmRProcessingDirection, sizeof(unsigned char),
|
||||||
offset(processingDirection), XtRImmediate, (caddr_t)XmMAX_ON_RIGHT},
|
offset(processingDirection), XtRImmediate, (caddr_t)XmMAX_ON_RIGHT},
|
||||||
|
|
||||||
{XmNdragCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList),
|
{XmNdragCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList),
|
||||||
offset(dragCallback), XtRImmediate, (caddr_t)NULL},
|
offset(dragCallback), XtRImmediate, (caddr_t)NULL},
|
||||||
|
|
||||||
{XmNvalueChangedCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList),
|
{XmNvalueChangedCallback, XmCCallback, XmRCallback, sizeof(XtCallbackList),
|
||||||
offset(valueChangedCallback), XtRImmediate, (caddr_t)NULL},
|
offset(valueChangedCallback), XtRImmediate, (caddr_t)NULL},
|
||||||
|
|
||||||
|
|
||||||
#undef offset
|
#undef offset
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -598,7 +598,7 @@ WidgetClass xmGaugeWidgetClass = (WidgetClass)&xmGaugeClassRec;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GaugePick(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
GaugePick(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
||||||
{
|
{
|
||||||
/* Commented out for a read-only gauge in wxWindows */
|
/* Commented out for a read-only gauge in wxWindows */
|
||||||
@@ -610,7 +610,7 @@ GaugePick(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
|||||||
Boolean dragging = False;
|
Boolean dragging = False;
|
||||||
XButtonEvent *event = (XButtonEvent *)e;
|
XButtonEvent *event = (XButtonEvent *)e;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
x = event->x;
|
x = event->x;
|
||||||
y = event->y;
|
y = event->y;
|
||||||
sht = gw->primitive.shadow_thickness;
|
sht = gw->primitive.shadow_thickness;
|
||||||
@@ -619,10 +619,10 @@ GaugePick(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
|||||||
gw->primitive.bottom_shadow_GC,
|
gw->primitive.bottom_shadow_GC,
|
||||||
0, 0, w->core.width, w->core.height,
|
0, 0, w->core.width, w->core.height,
|
||||||
sht, XmSHADOW_IN);
|
sht, XmSHADOW_IN);
|
||||||
|
|
||||||
|
|
||||||
ratio = (float)((float)THIS.maximum -
|
ratio = (float)((float)THIS.maximum -
|
||||||
(float)THIS.minimum) / (float)THIS.value;
|
(float)THIS.minimum) / (float)THIS.value;
|
||||||
switch(THIS.orientation) {
|
switch(THIS.orientation) {
|
||||||
case XmHORIZONTAL:
|
case XmHORIZONTAL:
|
||||||
size = (w->core.width - 2 * sht) / ratio;
|
size = (w->core.width - 2 * sht) / ratio;
|
||||||
@@ -658,13 +658,13 @@ GaugePick(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
|||||||
THIS.dragging = dragging;
|
THIS.dragging = dragging;
|
||||||
THIS.oldx = x;
|
THIS.oldx = x;
|
||||||
THIS.oldy = y;
|
THIS.oldy = y;
|
||||||
#undef THIS
|
#undef THIS
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define round(x) ( (x) > 0 ? ((x) + 0.5) : -(-(x) + 0.5) )
|
#define round(x) ( (x) > 0 ? ((x) + 0.5) : -(-(x) + 0.5) )
|
||||||
|
|
||||||
void
|
void
|
||||||
GaugeDrag(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
GaugeDrag(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
||||||
{
|
{
|
||||||
/* Commented out for a read-only gauge in wxWindows */
|
/* Commented out for a read-only gauge in wxWindows */
|
||||||
@@ -674,13 +674,13 @@ GaugeDrag(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
|||||||
int sht, x, y, max, value;
|
int sht, x, y, max, value;
|
||||||
float ratio, nratio, size, nsize, fvalue, delta;
|
float ratio, nratio, size, nsize, fvalue, delta;
|
||||||
XMotionEvent *event = (XMotionEvent *)e;
|
XMotionEvent *event = (XMotionEvent *)e;
|
||||||
|
|
||||||
if( ! THIS.dragging) return;
|
if( ! THIS.dragging) return;
|
||||||
|
|
||||||
x = event->x;
|
x = event->x;
|
||||||
y = event->y;
|
y = event->y;
|
||||||
sht = gw->primitive.shadow_thickness;
|
sht = gw->primitive.shadow_thickness;
|
||||||
|
|
||||||
ratio = (float)THIS.value / (float)((float)THIS.maximum -
|
ratio = (float)THIS.value / (float)((float)THIS.maximum -
|
||||||
(float)THIS.minimum);
|
(float)THIS.minimum);
|
||||||
switch(THIS.orientation) {
|
switch(THIS.orientation) {
|
||||||
@@ -706,21 +706,21 @@ GaugeDrag(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
|||||||
if(nsize > (float)max) nsize = (float)max;
|
if(nsize > (float)max) nsize = (float)max;
|
||||||
if(nsize < (float)0 ) nsize = (float)0;
|
if(nsize < (float)0 ) nsize = (float)0;
|
||||||
nratio = nsize / (float)max;
|
nratio = nsize / (float)max;
|
||||||
|
|
||||||
fvalue = (int)((float)THIS.maximum -
|
fvalue = (int)((float)THIS.maximum -
|
||||||
(float)THIS.minimum) * (float)nsize / (float)max;
|
(float)THIS.minimum) * (float)nsize / (float)max;
|
||||||
value = round(fvalue);
|
value = round(fvalue);
|
||||||
|
|
||||||
THIS.value = value;
|
THIS.value = value;
|
||||||
THIS.oldx = x;
|
THIS.oldx = x;
|
||||||
THIS.oldy = y;
|
THIS.oldy = y;
|
||||||
|
|
||||||
/* clear old slider only if it was larger */
|
/* clear old slider only if it was larger */
|
||||||
DrawSlider(gw, (nsize < size));
|
DrawSlider(gw, (nsize < size));
|
||||||
|
|
||||||
{
|
{
|
||||||
XmGaugeCallbackStruct call;
|
XmGaugeCallbackStruct call;
|
||||||
|
|
||||||
if(NULL != THIS.dragCallback) {
|
if(NULL != THIS.dragCallback) {
|
||||||
call.reason = XmCR_DRAG;
|
call.reason = XmCR_DRAG;
|
||||||
call.event = e;
|
call.event = e;
|
||||||
@@ -728,12 +728,12 @@ GaugeDrag(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
|||||||
XtCallCallbacks(w, XmNdragCallback, &call);
|
XtCallCallbacks(w, XmNdragCallback, &call);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef THIS
|
#undef THIS
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GaugeDrop(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
GaugeDrop(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
||||||
{
|
{
|
||||||
/* Commented out for a read-only gauge in wxWindows */
|
/* Commented out for a read-only gauge in wxWindows */
|
||||||
@@ -741,7 +741,7 @@ GaugeDrop(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
|||||||
XmGaugeWidget gw = (XmGaugeWidget)w;
|
XmGaugeWidget gw = (XmGaugeWidget)w;
|
||||||
#define THIS gw->gauge
|
#define THIS gw->gauge
|
||||||
if( ! THIS.dragging) return;
|
if( ! THIS.dragging) return;
|
||||||
|
|
||||||
if(NULL != THIS.valueChangedCallback) {
|
if(NULL != THIS.valueChangedCallback) {
|
||||||
XmGaugeCallbackStruct call;
|
XmGaugeCallbackStruct call;
|
||||||
call.reason = XmCR_VALUE_CHANGED;
|
call.reason = XmCR_VALUE_CHANGED;
|
||||||
@@ -750,7 +750,7 @@ GaugeDrop(Widget w, XEvent *e, String *args, Cardinal *num_args)
|
|||||||
XtCallCallbacks(w, XmNvalueChangedCallback, &call);
|
XtCallCallbacks(w, XmNvalueChangedCallback, &call);
|
||||||
}
|
}
|
||||||
THIS.dragging = False;
|
THIS.dragging = False;
|
||||||
#undef THIS
|
#undef THIS
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,7 +758,7 @@ void
|
|||||||
XmGaugeSetValue(Widget w, int value)
|
XmGaugeSetValue(Widget w, int value)
|
||||||
{
|
{
|
||||||
XmGaugeWidget gw = (XmGaugeWidget)w;
|
XmGaugeWidget gw = (XmGaugeWidget)w;
|
||||||
|
|
||||||
gw->gauge.value = value;
|
gw->gauge.value = value;
|
||||||
DrawSlider(gw, True);
|
DrawSlider(gw, True);
|
||||||
XFlush(XtDisplay(w));
|
XFlush(XtDisplay(w));
|
||||||
@@ -766,8 +766,8 @@ XmGaugeSetValue(Widget w, int value)
|
|||||||
|
|
||||||
int
|
int
|
||||||
XmGaugeGetValue(Widget w)
|
XmGaugeGetValue(Widget w)
|
||||||
{
|
{
|
||||||
XmGaugeWidget gw = (XmGaugeWidget)w;
|
XmGaugeWidget gw = (XmGaugeWidget)w;
|
||||||
|
|
||||||
return gw->gauge.value;
|
return gw->gauge.value;
|
||||||
}
|
}
|
||||||
|
@@ -778,9 +778,7 @@ bool wxMenuBar::CreateMenuBar(wxFrame* parent)
|
|||||||
wxString title(m_titles[i]);
|
wxString title(m_titles[i]);
|
||||||
menu->SetButtonWidget(menu->CreateMenu (this, menuBarW, menu, title, TRUE));
|
menu->SetButtonWidget(menu->CreateMenu (this, menuBarW, menu, title, TRUE));
|
||||||
|
|
||||||
wxStripMenuCodes ((char*) (const char*) title, wxBuffer);
|
if (strcmp (wxStripMenuCodes(title), "Help") == 0)
|
||||||
|
|
||||||
if (strcmp (wxBuffer, "Help") == 0)
|
|
||||||
XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL);
|
XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL);
|
||||||
|
|
||||||
// tear off menu support
|
// tear off menu support
|
||||||
@@ -910,8 +908,9 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
|
|||||||
|
|
||||||
menu = XmCreatePulldownMenu ((Widget) parent, "pulldown", args, 2);
|
menu = XmCreatePulldownMenu ((Widget) parent, "pulldown", args, 2);
|
||||||
|
|
||||||
XmString label_str = XmStringCreateSimple (wxBuffer);
|
wxString title2(wxStripMenuCodes(title));
|
||||||
buttonWidget = XtVaCreateManagedWidget (wxBuffer,
|
wxXmString label_str(title2);
|
||||||
|
buttonWidget = XtVaCreateManagedWidget(title2,
|
||||||
#if wxUSE_GADGETS
|
#if wxUSE_GADGETS
|
||||||
xmCascadeButtonGadgetClass, (Widget) parent,
|
xmCascadeButtonGadgetClass, (Widget) parent,
|
||||||
#else
|
#else
|
||||||
@@ -923,8 +922,6 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
|
|||||||
|
|
||||||
if (mnem != 0)
|
if (mnem != 0)
|
||||||
XtVaSetValues (buttonWidget, XmNmnemonic, mnem, NULL);
|
XtVaSetValues (buttonWidget, XmNmnemonic, mnem, NULL);
|
||||||
|
|
||||||
XmStringFree (label_str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_menuWidget = (WXWidget) menu;
|
m_menuWidget = (WXWidget) menu;
|
||||||
|
@@ -65,20 +65,20 @@ m_bCheckable(bCheckable),
|
|||||||
m_strName(strName)
|
m_strName(strName)
|
||||||
{
|
{
|
||||||
wxASSERT( pParentMenu != NULL );
|
wxASSERT( pParentMenu != NULL );
|
||||||
|
|
||||||
m_pParentMenu = pParentMenu;
|
m_pParentMenu = pParentMenu;
|
||||||
m_pSubMenu = pSubMenu;
|
m_pSubMenu = pSubMenu;
|
||||||
m_idItem = id;
|
m_idItem = id;
|
||||||
m_bEnabled = TRUE;
|
m_bEnabled = TRUE;
|
||||||
m_bChecked = FALSE;
|
m_bChecked = FALSE;
|
||||||
|
|
||||||
//// Motif-specific
|
//// Motif-specific
|
||||||
m_menuBar = NULL;
|
m_menuBar = NULL;
|
||||||
m_buttonWidget = (WXWidget) NULL;
|
m_buttonWidget = (WXWidget) NULL;
|
||||||
m_topMenu = NULL;
|
m_topMenu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMenuItem::~wxMenuItem()
|
wxMenuItem::~wxMenuItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ wxMenuItem::~wxMenuItem()
|
|||||||
void wxMenuItem::DeleteSubMenu()
|
void wxMenuItem::DeleteSubMenu()
|
||||||
{
|
{
|
||||||
wxASSERT( m_pSubMenu != NULL );
|
wxASSERT( m_pSubMenu != NULL );
|
||||||
|
|
||||||
delete m_pSubMenu;
|
delete m_pSubMenu;
|
||||||
m_pSubMenu = NULL;
|
m_pSubMenu = NULL;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ void wxMenuItem::Enable(bool bDoEnable)
|
|||||||
if (m_buttonWidget)
|
if (m_buttonWidget)
|
||||||
XtSetSensitive( (Widget) m_buttonWidget, (Boolean) bDoEnable);
|
XtSetSensitive( (Widget) m_buttonWidget, (Boolean) bDoEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bEnabled = bDoEnable;
|
m_bEnabled = bDoEnable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ void wxMenuItem::Enable(bool bDoEnable)
|
|||||||
void wxMenuItem::Check(bool bDoCheck)
|
void wxMenuItem::Check(bool bDoCheck)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
|
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
|
||||||
|
|
||||||
if ( m_bChecked != bDoCheck )
|
if ( m_bChecked != bDoCheck )
|
||||||
{
|
{
|
||||||
if (m_buttonWidget && XtIsSubclass ((Widget) m_buttonWidget, xmToggleButtonGadgetClass))
|
if (m_buttonWidget && XtIsSubclass ((Widget) m_buttonWidget, xmToggleButtonGadgetClass))
|
||||||
@@ -138,48 +138,47 @@ void wxMenuItem::CreateItem (WXWidget menu, wxMenuBar * menuBar, wxMenu * topMen
|
|||||||
{
|
{
|
||||||
m_menuBar = menuBar;
|
m_menuBar = menuBar;
|
||||||
m_topMenu = topMenu;
|
m_topMenu = topMenu;
|
||||||
|
|
||||||
if (GetId() == -2)
|
if (GetId() == -2)
|
||||||
{
|
{
|
||||||
// Id=-2 identifies a Title item.
|
// Id=-2 identifies a Title item.
|
||||||
wxStripMenuCodes ((char*) (const char*) m_strName, wxBuffer);
|
m_buttonWidget = (WXWidget) XtVaCreateManagedWidget
|
||||||
m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (wxBuffer,
|
(wxStripMenuCodes(m_strName),
|
||||||
xmLabelGadgetClass, (Widget) menu, NULL);
|
xmLabelGadgetClass, (Widget) menu, NULL);
|
||||||
}
|
}
|
||||||
else if ((!m_strName.IsNull() && m_strName != "") && (!m_pSubMenu))
|
else if ((!m_strName.IsNull() && m_strName != "") && (!m_pSubMenu))
|
||||||
{
|
{
|
||||||
wxStripMenuCodes ((char*) (const char*) m_strName, wxBuffer);
|
wxString strName = wxStripMenuCodes(m_strName);
|
||||||
if (IsCheckable())
|
if (IsCheckable())
|
||||||
{
|
{
|
||||||
m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (wxBuffer,
|
m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (strName,
|
||||||
xmToggleButtonGadgetClass, (Widget) menu,
|
xmToggleButtonGadgetClass, (Widget) menu,
|
||||||
NULL);
|
NULL);
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNset, (Boolean) IsChecked(), NULL);
|
XtVaSetValues ((Widget) m_buttonWidget, XmNset, (Boolean) IsChecked(), NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (wxBuffer,
|
m_buttonWidget = (WXWidget) XtVaCreateManagedWidget (strName,
|
||||||
xmPushButtonGadgetClass, (Widget) menu,
|
xmPushButtonGadgetClass, (Widget) menu,
|
||||||
NULL);
|
NULL);
|
||||||
char mnem = wxFindMnemonic (m_strName);
|
char mnem = wxFindMnemonic (m_strName);
|
||||||
if (mnem != 0)
|
if (mnem != 0)
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNmnemonic, mnem, NULL);
|
XtVaSetValues ((Widget) m_buttonWidget, XmNmnemonic, mnem, NULL);
|
||||||
|
|
||||||
//// TODO: proper accelerator treatment. What does wxFindAccelerator
|
//// TODO: proper accelerator treatment. What does wxFindAccelerator
|
||||||
//// look for?
|
//// look for?
|
||||||
strcpy(wxBuffer, (char*) (const char*) m_strName);
|
strName = m_strName;
|
||||||
char *accel = wxFindAccelerator (wxBuffer);
|
char *accel = wxFindAccelerator (strName);
|
||||||
if (accel)
|
if (accel)
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNaccelerator, accel, NULL);
|
XtVaSetValues ((Widget) m_buttonWidget, XmNaccelerator, accel, NULL);
|
||||||
|
|
||||||
// TODO: What does this do?
|
// TODO: What does this do?
|
||||||
strcpy(wxBuffer, (char*) (const char*) m_strName);
|
XmString accel_str = wxFindAcceleratorText (strName);
|
||||||
XmString accel_str = wxFindAcceleratorText (wxBuffer);
|
|
||||||
if (accel_str)
|
if (accel_str)
|
||||||
{
|
{
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNacceleratorText, accel_str, NULL);
|
XtVaSetValues ((Widget) m_buttonWidget, XmNacceleratorText, accel_str, NULL);
|
||||||
XmStringFree (accel_str);
|
XmStringFree (accel_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsCheckable())
|
if (IsCheckable())
|
||||||
XtAddCallback ((Widget) m_buttonWidget,
|
XtAddCallback ((Widget) m_buttonWidget,
|
||||||
XmNvalueChangedCallback,
|
XmNvalueChangedCallback,
|
||||||
@@ -222,7 +221,7 @@ void wxMenuItem::DestroyItem(bool full)
|
|||||||
if (GetId() == -2)
|
if (GetId() == -2)
|
||||||
{
|
{
|
||||||
; // Nothing
|
; // Nothing
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ((!m_strName.IsNull() && (m_strName != "")) && !m_pSubMenu)
|
else if ((!m_strName.IsNull() && (m_strName != "")) && !m_pSubMenu)
|
||||||
{
|
{
|
||||||
@@ -243,7 +242,7 @@ void wxMenuItem::DestroyItem(bool full)
|
|||||||
else if (GetId() == -1)
|
else if (GetId() == -1)
|
||||||
{
|
{
|
||||||
; // Nothing
|
; // Nothing
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (GetSubMenu())
|
else if (GetSubMenu())
|
||||||
{
|
{
|
||||||
@@ -256,7 +255,7 @@ void wxMenuItem::DestroyItem(bool full)
|
|||||||
if (full)
|
if (full)
|
||||||
m_buttonWidget = NULL;
|
m_buttonWidget = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_buttonWidget && full)
|
if (m_buttonWidget && full)
|
||||||
{
|
{
|
||||||
XtDestroyWidget ((Widget) m_buttonWidget);
|
XtDestroyWidget ((Widget) m_buttonWidget);
|
||||||
@@ -267,26 +266,23 @@ void wxMenuItem::DestroyItem(bool full)
|
|||||||
void wxMenuItem::SetLabel(const wxString& label)
|
void wxMenuItem::SetLabel(const wxString& label)
|
||||||
{
|
{
|
||||||
char mnem = wxFindMnemonic (label);
|
char mnem = wxFindMnemonic (label);
|
||||||
wxStripMenuCodes ((char*) (const char*) label, wxBuffer);
|
wxString label2 = wxStripMenuCodes(label);
|
||||||
|
|
||||||
m_strName = label;
|
m_strName = label;
|
||||||
|
|
||||||
if (m_buttonWidget)
|
if (m_buttonWidget)
|
||||||
{
|
{
|
||||||
XmString label_str = XmStringCreateSimple (wxBuffer);
|
wxXmString label_str(label2);
|
||||||
XtVaSetValues ((Widget) m_buttonWidget,
|
XtVaSetValues ((Widget) m_buttonWidget,
|
||||||
XmNlabelString, label_str,
|
XmNlabelString, label_str,
|
||||||
NULL);
|
NULL);
|
||||||
XmStringFree (label_str);
|
|
||||||
if (mnem != 0)
|
if (mnem != 0)
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNmnemonic, mnem, NULL);
|
XtVaSetValues ((Widget) m_buttonWidget, XmNmnemonic, mnem, NULL);
|
||||||
strcpy(wxBuffer, (char*) (const char*) label);
|
char *accel = wxFindAccelerator (label2);
|
||||||
char *accel = wxFindAccelerator (wxBuffer);
|
|
||||||
if (accel)
|
if (accel)
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNaccelerator, accel, NULL);
|
XtVaSetValues ((Widget) m_buttonWidget, XmNaccelerator, accel, NULL);
|
||||||
|
|
||||||
strcpy(wxBuffer, (char*) (const char*) label);
|
XmString accel_str = wxFindAcceleratorText (label2);
|
||||||
XmString accel_str = wxFindAcceleratorText (wxBuffer);
|
|
||||||
if (accel_str)
|
if (accel_str)
|
||||||
{
|
{
|
||||||
XtVaSetValues ((Widget) m_buttonWidget, XmNacceleratorText, accel_str, NULL);
|
XtVaSetValues ((Widget) m_buttonWidget, XmNacceleratorText, accel_str, NULL);
|
||||||
@@ -312,7 +308,7 @@ void wxMenuItemCallback (Widget w, XtPointer clientData,
|
|||||||
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item->GetId());
|
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item->GetId());
|
||||||
commandEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
commandEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
||||||
commandEvent.SetInt( item->GetId() );
|
commandEvent.SetInt( item->GetId() );
|
||||||
|
|
||||||
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(commandEvent);
|
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(commandEvent);
|
||||||
}
|
}
|
||||||
else if (item->GetTopMenu())
|
else if (item->GetTopMenu())
|
||||||
@@ -320,7 +316,7 @@ void wxMenuItemCallback (Widget w, XtPointer clientData,
|
|||||||
wxCommandEvent event (wxEVT_COMMAND_MENU_SELECTED, item->GetId());
|
wxCommandEvent event (wxEVT_COMMAND_MENU_SELECTED, item->GetId());
|
||||||
event.SetEventObject(item->GetTopMenu());
|
event.SetEventObject(item->GetTopMenu());
|
||||||
event.SetInt( item->GetId() );
|
event.SetInt( item->GetId() );
|
||||||
|
|
||||||
item->GetTopMenu()->ProcessCommand (event);
|
item->GetTopMenu()->ProcessCommand (event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,13 +332,13 @@ void wxMenuItemArmCallback (Widget w, XtPointer clientData,
|
|||||||
{
|
{
|
||||||
wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, item->GetId());
|
wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, item->GetId());
|
||||||
menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
||||||
|
|
||||||
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(menuEvent);
|
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(menuEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wxMenuItemDisarmCallback (Widget w, XtPointer clientData,
|
wxMenuItemDisarmCallback (Widget w, XtPointer clientData,
|
||||||
XtPointer ptr)
|
XtPointer ptr)
|
||||||
{
|
{
|
||||||
@@ -355,7 +351,7 @@ wxMenuItemDisarmCallback (Widget w, XtPointer clientData,
|
|||||||
// special to event system
|
// special to event system
|
||||||
wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, -1);
|
wxMenuEvent menuEvent(wxEVT_MENU_HIGHLIGHT, -1);
|
||||||
menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
menuEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
|
||||||
|
|
||||||
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(menuEvent);
|
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(menuEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -88,9 +88,9 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
|
|
||||||
wxString label1(wxStripMenuCodes(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,
|
xmFormWidgetClass, parentWidget,
|
||||||
XmNmarginHeight, 0,
|
XmNmarginHeight, 0,
|
||||||
XmNmarginWidth, 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));
|
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
||||||
if (label1 != "")
|
if (label1 != "")
|
||||||
{
|
{
|
||||||
text = XmStringCreateSimple ((char*) (const char*) label1);
|
wxXmString text(label1);
|
||||||
Widget labelWidget = XtVaCreateManagedWidget ((char*) (const char*) label1,
|
(void)XtVaCreateManagedWidget(label1.c_str(),
|
||||||
#if wxUSE_GADGETS
|
#if wxUSE_GADGETS
|
||||||
style & wxCOLOURED ?
|
style & wxCOLOURED ? xmLabelWidgetClass
|
||||||
xmLabelWidgetClass : xmLabelGadgetClass,
|
: xmLabelGadgetClass,
|
||||||
formWidget,
|
formWidget,
|
||||||
#else
|
#else
|
||||||
xmLabelWidgetClass, formWidget,
|
xmLabelWidgetClass, formWidget,
|
||||||
@@ -113,8 +113,6 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
XmNfontList, fontList,
|
XmNfontList, fontList,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
XmStringFree (text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget frameWidget = XtVaCreateManagedWidget ("frame",
|
Widget frameWidget = XtVaCreateManagedWidget ("frame",
|
||||||
|
@@ -48,24 +48,24 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_backgroundColour = parent->GetBackgroundColour();
|
m_backgroundColour = parent->GetBackgroundColour();
|
||||||
m_foregroundColour = parent->GetForegroundColour();
|
m_foregroundColour = parent->GetForegroundColour();
|
||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
m_windowStyle = style ;
|
m_windowStyle = style ;
|
||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
wxString label1(wxStripMenuCodes(label));
|
wxString label1(wxStripMenuCodes(label));
|
||||||
|
|
||||||
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
|
||||||
|
|
||||||
Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle",
|
Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle",
|
||||||
#if wxUSE_GADGETS
|
#if wxUSE_GADGETS
|
||||||
xmToggleButtonGadgetClass, parentWidget,
|
xmToggleButtonGadgetClass, parentWidget,
|
||||||
@@ -78,19 +78,19 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
XmNindicatorType, XmONE_OF_MANY, // diamond-shape
|
XmNindicatorType, XmONE_OF_MANY, // diamond-shape
|
||||||
NULL);
|
NULL);
|
||||||
XmStringFree (text);
|
XmStringFree (text);
|
||||||
|
|
||||||
XtAddCallback (radioButtonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxRadioButtonCallback,
|
XtAddCallback (radioButtonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxRadioButtonCallback,
|
||||||
(XtCallbackProc) this);
|
(XtCallbackProc) this);
|
||||||
|
|
||||||
m_mainWidget = (WXWidget) radioButtonWidget;
|
m_mainWidget = (WXWidget) radioButtonWidget;
|
||||||
|
|
||||||
XtManageChild (radioButtonWidget);
|
XtManageChild (radioButtonWidget);
|
||||||
|
|
||||||
SetCanAddEventHandler(TRUE);
|
SetCanAddEventHandler(TRUE);
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,14 +140,14 @@ void wxRadioButtonCallback (Widget w, XtPointer clientData,
|
|||||||
{
|
{
|
||||||
if (!cbs->set)
|
if (!cbs->set)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxRadioButton *item = (wxRadioButton *) clientData;
|
wxRadioButton *item = (wxRadioButton *) clientData;
|
||||||
if (item->InSetValue())
|
if (item->InSetValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxCommandEvent event (wxEVT_COMMAND_RADIOBUTTON_SELECTED, item->GetId());
|
wxCommandEvent event (wxEVT_COMMAND_RADIOBUTTON_SELECTED, item->GetId());
|
||||||
event.SetEventObject(item);
|
event.SetEventObject(item);
|
||||||
|
|
||||||
item->ProcessCommand (event);
|
item->ProcessCommand (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -43,13 +43,13 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_backgroundColour = parent->GetBackgroundColour();
|
m_backgroundColour = parent->GetBackgroundColour();
|
||||||
m_foregroundColour = parent->GetForegroundColour();
|
m_foregroundColour = parent->GetForegroundColour();
|
||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
int x = pos.x;
|
int x = pos.x;
|
||||||
int y = pos.y;
|
int y = pos.y;
|
||||||
|
@@ -56,26 +56,26 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
m_backgroundColour = parent->GetBackgroundColour();
|
m_backgroundColour = parent->GetBackgroundColour();
|
||||||
m_foregroundColour = parent->GetForegroundColour();
|
m_foregroundColour = parent->GetForegroundColour();
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
m_lineSize = 1;
|
m_lineSize = 1;
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_tickFreq = 0;
|
m_tickFreq = 0;
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
m_rangeMax = maxValue;
|
m_rangeMax = maxValue;
|
||||||
m_rangeMin = minValue;
|
m_rangeMin = minValue;
|
||||||
|
|
||||||
// Not used in Motif, I think
|
// Not used in Motif, I think
|
||||||
m_pageSize = (int)((maxValue-minValue)/10);
|
m_pageSize = (int)((maxValue-minValue)/10);
|
||||||
|
|
||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
Widget sliderWidget = XtVaCreateManagedWidget ("sliderWidget",
|
Widget sliderWidget = XtVaCreateManagedWidget ("sliderWidget",
|
||||||
xmScaleWidgetClass, parentWidget,
|
xmScaleWidgetClass, parentWidget,
|
||||||
XmNorientation,
|
XmNorientation,
|
||||||
@@ -87,26 +87,26 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
XmNvalue, value,
|
XmNvalue, value,
|
||||||
XmNshowValue, True,
|
XmNshowValue, True,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m_mainWidget = (WXWidget) sliderWidget;
|
m_mainWidget = (WXWidget) sliderWidget;
|
||||||
|
|
||||||
if(style & wxSL_NOTIFY_DRAG)
|
if(style & wxSL_NOTIFY_DRAG)
|
||||||
XtAddCallback (sliderWidget, XmNdragCallback,
|
XtAddCallback (sliderWidget, XmNdragCallback,
|
||||||
(XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
(XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
||||||
else
|
else
|
||||||
XtAddCallback (sliderWidget, XmNvalueChangedCallback,
|
XtAddCallback (sliderWidget, XmNvalueChangedCallback,
|
||||||
(XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
(XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
||||||
|
|
||||||
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
XtAddCallback (sliderWidget, XmNdragCallback, (XtCallbackProc) wxSliderCallback, (XtPointer) this);
|
||||||
|
|
||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
|
|
||||||
ChangeFont(FALSE);
|
ChangeFont(FALSE);
|
||||||
SetCanAddEventHandler(TRUE);
|
SetCanAddEventHandler(TRUE);
|
||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,30 +134,30 @@ void wxSlider::GetSize(int *width, int *height) const
|
|||||||
void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
Widget widget = (Widget) m_mainWidget;
|
Widget widget = (Widget) m_mainWidget;
|
||||||
|
|
||||||
bool managed = XtIsManaged(widget);
|
bool managed = XtIsManaged(widget);
|
||||||
|
|
||||||
if (managed)
|
if (managed)
|
||||||
XtUnmanageChild (widget);
|
XtUnmanageChild (widget);
|
||||||
|
|
||||||
if (((m_windowStyle & wxHORIZONTAL) == wxHORIZONTAL) && (width > -1))
|
if (((m_windowStyle & wxHORIZONTAL) == wxHORIZONTAL) && (width > -1))
|
||||||
{
|
{
|
||||||
XtVaSetValues (widget, XmNscaleWidth, wxMax (width, 10), NULL);
|
XtVaSetValues (widget, XmNscaleWidth, wxMax (width, 10), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((m_windowStyle & wxVERTICAL) == wxVERTICAL) && (height > -1))
|
if (((m_windowStyle & wxVERTICAL) == wxVERTICAL) && (height > -1))
|
||||||
{
|
{
|
||||||
XtVaSetValues (widget, XmNscaleHeight, wxMax (height, 10), NULL);
|
XtVaSetValues (widget, XmNscaleHeight, wxMax (height, 10), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int xx = x; int yy = y;
|
int xx = x; int yy = y;
|
||||||
AdjustForParentClientOrigin(xx, yy, sizeFlags);
|
AdjustForParentClientOrigin(xx, yy, sizeFlags);
|
||||||
|
|
||||||
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (x > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
XtVaSetValues (widget, XmNx, xx, NULL);
|
XtVaSetValues (widget, XmNx, xx, NULL);
|
||||||
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
if (y > -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
XtVaSetValues (widget, XmNy, yy, NULL);
|
XtVaSetValues (widget, XmNy, yy, NULL);
|
||||||
|
|
||||||
if (managed)
|
if (managed)
|
||||||
XtManageChild (widget);
|
XtManageChild (widget);
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ void wxSlider::SetRange(int minValue, int maxValue)
|
|||||||
{
|
{
|
||||||
m_rangeMin = minValue;
|
m_rangeMin = minValue;
|
||||||
m_rangeMax = maxValue;
|
m_rangeMax = maxValue;
|
||||||
|
|
||||||
XtVaSetValues ((Widget) m_mainWidget, XmNminimum, minValue, XmNmaximum, maxValue, NULL);
|
XtVaSetValues ((Widget) m_mainWidget, XmNminimum, minValue, XmNmaximum, maxValue, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,12 +276,12 @@ void wxSliderCallback (Widget widget, XtPointer clientData, XmScaleCallbackStruc
|
|||||||
// TODO: the XmCR_VALUE_CHANGED case should be handled
|
// TODO: the XmCR_VALUE_CHANGED case should be handled
|
||||||
// differently (it's not sent continually as the slider moves).
|
// differently (it's not sent continually as the slider moves).
|
||||||
// In which case we need a similar behaviour for other platforms.
|
// In which case we need a similar behaviour for other platforms.
|
||||||
|
|
||||||
wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, slider->GetId());
|
wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, slider->GetId());
|
||||||
XtVaGetValues (widget, XmNvalue, &event.m_commandInt, NULL);
|
XtVaGetValues (widget, XmNvalue, &event.m_commandInt, NULL);
|
||||||
event.SetEventObject(slider);
|
event.SetEventObject(slider);
|
||||||
slider->ProcessCommand(event);
|
slider->ProcessCommand(event);
|
||||||
|
|
||||||
// Also send a wxCommandEvent for compatibility.
|
// Also send a wxCommandEvent for compatibility.
|
||||||
wxCommandEvent event2(wxEVT_COMMAND_SLIDER_UPDATED, slider->GetId());
|
wxCommandEvent event2(wxEVT_COMMAND_SLIDER_UPDATED, slider->GetId());
|
||||||
event2.SetEventObject(slider);
|
event2.SetEventObject(slider);
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -17,14 +17,9 @@
|
|||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxSpinButton::wxSpinButton()
|
|
||||||
{
|
|
||||||
m_min = 0;
|
|
||||||
m_max = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||||
long style, const wxString& name)
|
long style, const wxString& name)
|
||||||
{
|
{
|
||||||
@@ -33,9 +28,8 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
|||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
m_min = 0;
|
InitBase();
|
||||||
m_max = 100;
|
|
||||||
|
|
||||||
m_windowId = (id == -1) ? NewControlId() : id;
|
m_windowId = (id == -1) ? NewControlId() : id;
|
||||||
|
|
||||||
@@ -52,20 +46,19 @@ wxSpinButton::~wxSpinButton()
|
|||||||
|
|
||||||
int wxSpinButton::GetValue() const
|
int wxSpinButton::GetValue() const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinButton::SetValue(int val)
|
void wxSpinButton::SetValue(int val)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinButton::SetRange(int minVal, int maxVal)
|
void wxSpinButton::SetRange(int minVal, int maxVal)
|
||||||
{
|
{
|
||||||
m_min = minVal;
|
// TODO
|
||||||
m_max = maxVal;
|
wxSpinButtonBase::SetRange(minVal, maxVal);
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinButton::ChangeFont(bool keepOriginalSize)
|
void wxSpinButton::ChangeFont(bool keepOriginalSize)
|
||||||
@@ -82,12 +75,3 @@ void wxSpinButton::ChangeForegroundColour()
|
|||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spin event
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
|
||||||
|
|
||||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
|
|
||||||
wxScrollEvent(commandType, id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -44,9 +44,9 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
|
|||||||
XtVaSetValues (widget,
|
XtVaSetValues (widget,
|
||||||
XmNlabelPixmap, ((wxBitmap&)bitmap).GetLabelPixmap (widget),
|
XmNlabelPixmap, ((wxBitmap&)bitmap).GetLabelPixmap (widget),
|
||||||
XmNlabelType, XmPIXMAP,
|
XmNlabelType, XmPIXMAP,
|
||||||
NULL);
|
NULL);
|
||||||
GetSize(&w1, &h1);
|
GetSize(&w1, &h1);
|
||||||
|
|
||||||
if (! (w1 == w2) && (h1 == h2))
|
if (! (w1 == w2) && (h1 == h2))
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
|
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
|
||||||
// EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
|
//EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -35,7 +35,7 @@ END_EVENT_TABLE()
|
|||||||
/*
|
/*
|
||||||
* Static box
|
* Static box
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxStaticBox::wxStaticBox()
|
wxStaticBox::wxStaticBox()
|
||||||
{
|
{
|
||||||
m_formWidget = (WXWidget) 0;
|
m_formWidget = (WXWidget) 0;
|
||||||
@@ -60,9 +60,9 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
@@ -71,10 +71,10 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
Widget parentWidget = (Widget) parent->GetClientWidget();
|
Widget parentWidget = (Widget) parent->GetClientWidget();
|
||||||
|
|
||||||
Widget formWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
|
Widget formWidget = XtVaCreateManagedWidget ((char*) (const char*) name,
|
||||||
xmFormWidgetClass, parentWidget,
|
xmFormWidgetClass, parentWidget,
|
||||||
XmNmarginHeight, 0,
|
XmNmarginHeight, 0,
|
||||||
XmNmarginWidth, 0,
|
XmNmarginWidth, 0,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
|
||||||
if (hasLabel)
|
if (hasLabel)
|
||||||
@@ -84,35 +84,35 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
wxString label1(wxStripMenuCodes(label));
|
wxString label1(wxStripMenuCodes(label));
|
||||||
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
||||||
m_labelWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) label1,
|
m_labelWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) label1,
|
||||||
xmLabelWidgetClass, formWidget,
|
xmLabelWidgetClass, formWidget,
|
||||||
XmNfontList, fontList,
|
XmNfontList, fontList,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text,
|
||||||
NULL);
|
NULL);
|
||||||
XmStringFree (text);
|
XmStringFree (text);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget frameWidget = XtVaCreateManagedWidget ("frame",
|
Widget frameWidget = XtVaCreateManagedWidget ("frame",
|
||||||
xmFrameWidgetClass, formWidget,
|
xmFrameWidgetClass, formWidget,
|
||||||
XmNshadowType, XmSHADOW_IN,
|
XmNshadowType, XmSHADOW_IN,
|
||||||
// XmNmarginHeight, 0,
|
//XmNmarginHeight, 0,
|
||||||
// XmNmarginWidth, 0,
|
//XmNmarginWidth, 0,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (hasLabel)
|
if (hasLabel)
|
||||||
XtVaSetValues ((Widget) m_labelWidget,
|
XtVaSetValues ((Widget) m_labelWidget,
|
||||||
XmNtopAttachment, XmATTACH_FORM,
|
XmNtopAttachment, XmATTACH_FORM,
|
||||||
XmNleftAttachment, XmATTACH_FORM,
|
XmNleftAttachment, XmATTACH_FORM,
|
||||||
XmNrightAttachment, XmATTACH_FORM,
|
XmNrightAttachment, XmATTACH_FORM,
|
||||||
XmNalignment, XmALIGNMENT_BEGINNING,
|
XmNalignment, XmALIGNMENT_BEGINNING,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
XtVaSetValues (frameWidget,
|
XtVaSetValues (frameWidget,
|
||||||
XmNtopAttachment, hasLabel ? XmATTACH_WIDGET : XmATTACH_FORM,
|
XmNtopAttachment, hasLabel ? XmATTACH_WIDGET : XmATTACH_FORM,
|
||||||
XmNtopWidget, hasLabel ? (Widget) m_labelWidget : formWidget,
|
XmNtopWidget, hasLabel ? (Widget) m_labelWidget : formWidget,
|
||||||
XmNbottomAttachment, XmATTACH_FORM,
|
XmNbottomAttachment, XmATTACH_FORM,
|
||||||
XmNleftAttachment, XmATTACH_FORM,
|
XmNleftAttachment, XmATTACH_FORM,
|
||||||
XmNrightAttachment, XmATTACH_FORM,
|
XmNrightAttachment, XmATTACH_FORM,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m_mainWidget = (WXWidget) frameWidget;
|
m_mainWidget = (WXWidget) frameWidget;
|
||||||
m_formWidget = (WXWidget) formWidget;
|
m_formWidget = (WXWidget) formWidget;
|
||||||
@@ -149,9 +149,9 @@ void wxStaticBox::SetLabel(const wxString& label)
|
|||||||
|
|
||||||
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
XmString text = XmStringCreateSimple ((char*) (const char*) label1);
|
||||||
XtVaSetValues ((Widget) m_labelWidget,
|
XtVaSetValues ((Widget) m_labelWidget,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text,
|
||||||
XmNlabelType, XmSTRING,
|
XmNlabelType, XmSTRING,
|
||||||
NULL);
|
NULL);
|
||||||
XmStringFree (text);
|
XmStringFree (text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,8 +164,8 @@ wxString wxStaticBox::GetLabel() const
|
|||||||
XmString text = 0;
|
XmString text = 0;
|
||||||
char *s;
|
char *s;
|
||||||
XtVaGetValues ((Widget) m_labelWidget,
|
XtVaGetValues ((Widget) m_labelWidget,
|
||||||
XmNlabelString, &text,
|
XmNlabelString, &text,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!text)
|
if (!text)
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
@@ -193,10 +193,10 @@ void wxStaticBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
if (width > -1)
|
if (width > -1)
|
||||||
XtVaSetValues ((Widget) m_mainWidget, XmNwidth, width,
|
XtVaSetValues ((Widget) m_mainWidget, XmNwidth, width,
|
||||||
NULL);
|
NULL);
|
||||||
if (height > -1)
|
if (height > -1)
|
||||||
XtVaSetValues ((Widget) m_mainWidget, XmNheight, height - yy,
|
XtVaSetValues ((Widget) m_mainWidget, XmNheight, height - yy,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -40,9 +40,9 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_foregroundColour = parent->GetForegroundColour();
|
m_foregroundColour = parent->GetForegroundColour();
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_font = parent->GetFont();
|
m_font = parent->GetFont();
|
||||||
|
@@ -83,9 +83,6 @@ static void wxTextWindowActivateProc(Widget w, XtPointer clientData, XmAnyCallba
|
|||||||
|
|
||||||
// Text item
|
// Text item
|
||||||
wxTextCtrl::wxTextCtrl()
|
wxTextCtrl::wxTextCtrl()
|
||||||
#ifndef NO_TEXT_WINDOW_STREAM
|
|
||||||
: streambuf()
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
m_tempCallbackStruct = (void*) NULL;
|
m_tempCallbackStruct = (void*) NULL;
|
||||||
m_modified = FALSE;
|
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)
|
void wxTextCtrl::OnChar(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
// Indicates that we should generate a normal command, because
|
// Indicates that we should generate a normal command, because
|
||||||
|
@@ -725,7 +725,7 @@ char wxFindMnemonic (const char *s)
|
|||||||
return mnem;
|
return mnem;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * wxFindAccelerator (char *s)
|
char * wxFindAccelerator (const char *s)
|
||||||
{
|
{
|
||||||
// The accelerator text is after the \t char.
|
// The accelerator text is after the \t char.
|
||||||
while (*s && *s != '\t')
|
while (*s && *s != '\t')
|
||||||
@@ -748,7 +748,7 @@ char * wxFindAccelerator (char *s)
|
|||||||
wxBuffer[0] = '\0';
|
wxBuffer[0] = '\0';
|
||||||
char *tmp = copystring (s);
|
char *tmp = copystring (s);
|
||||||
s = tmp;
|
s = tmp;
|
||||||
char *p = s;
|
char *p = tmp;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@@ -763,8 +763,7 @@ char * wxFindAccelerator (char *s)
|
|||||||
strcat (wxBuffer, s);
|
strcat (wxBuffer, s);
|
||||||
else
|
else
|
||||||
strcat (wxBuffer, "Meta");
|
strcat (wxBuffer, "Meta");
|
||||||
s = p + 1;
|
s = p++;
|
||||||
p = s;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -777,7 +776,7 @@ char * wxFindAccelerator (char *s)
|
|||||||
return wxBuffer;
|
return wxBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmString wxFindAcceleratorText (char *s)
|
XmString wxFindAcceleratorText (const char *s)
|
||||||
{
|
{
|
||||||
// The accelerator text is after the \t char.
|
// The accelerator text is after the \t char.
|
||||||
while (*s && *s != '\t')
|
while (*s && *s != '\t')
|
||||||
@@ -785,7 +784,7 @@ XmString wxFindAcceleratorText (char *s)
|
|||||||
if (*s == '\0')
|
if (*s == '\0')
|
||||||
return (NULL);
|
return (NULL);
|
||||||
s++;
|
s++;
|
||||||
XmString text = XmStringCreateSimple (s);
|
XmString text = XmStringCreateSimple ((char *)s);
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1671,6 +1671,9 @@ bool wxAddWindowToTable(Widget w, wxWindow *win)
|
|||||||
|
|
||||||
wxWidgetHashTable->Put((long) w, win);
|
wxWidgetHashTable->Put((long) w, win);
|
||||||
|
|
||||||
|
wxLogDebug("Widget 0x%08x <-> window %p (%s)",
|
||||||
|
w, win, win->GetClassInfo()->GetClassName());
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -113,6 +113,7 @@ libwx_msw_la_SOURCES = \
|
|||||||
dcpsg.cpp \
|
dcpsg.cpp \
|
||||||
gridg.cpp \
|
gridg.cpp \
|
||||||
laywin.cpp \
|
laywin.cpp \
|
||||||
|
numdlgg.cpp \
|
||||||
panelg.cpp \
|
panelg.cpp \
|
||||||
progdlgg.cpp \
|
progdlgg.cpp \
|
||||||
prop.cpp \
|
prop.cpp \
|
||||||
|
@@ -38,16 +38,15 @@
|
|||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxSpinButton::wxSpinButton()
|
bool wxSpinButton::Create(wxWindow *parent,
|
||||||
{
|
wxWindowID id,
|
||||||
m_min = 0;
|
const wxPoint& pos,
|
||||||
m_max = 100;
|
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;
|
wxSystemSettings settings;
|
||||||
m_backgroundColour = parent->GetBackgroundColour() ;
|
m_backgroundColour = parent->GetBackgroundColour() ;
|
||||||
@@ -73,13 +72,12 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
|||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
m_min = 0;
|
InitBase();
|
||||||
m_max = 100;
|
|
||||||
|
|
||||||
m_windowId = (id == -1) ? NewControlId() : id;
|
m_windowId = (id == -1) ? NewControlId() : id;
|
||||||
|
|
||||||
DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
|
DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
|
||||||
|
|
||||||
if ( m_windowStyle & wxSP_HORIZONTAL )
|
if ( m_windowStyle & wxSP_HORIZONTAL )
|
||||||
wstyle |= UDS_HORZ;
|
wstyle |= UDS_HORZ;
|
||||||
if ( m_windowStyle & wxSP_ARROW_KEYS )
|
if ( m_windowStyle & wxSP_ARROW_KEYS )
|
||||||
@@ -102,7 +100,7 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
|||||||
// TODO: have this for all controls.
|
// TODO: have this for all controls.
|
||||||
if ( !m_hWnd )
|
if ( !m_hWnd )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
SubclassWin((WXHWND) m_hWnd);
|
SubclassWin((WXHWND) m_hWnd);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -127,8 +125,7 @@ void wxSpinButton::SetValue(int val)
|
|||||||
|
|
||||||
void wxSpinButton::SetRange(int minVal, int maxVal)
|
void wxSpinButton::SetRange(int minVal, int maxVal)
|
||||||
{
|
{
|
||||||
m_min = minVal;
|
wxSpinButtonBase::SetRange(minVal, maxVal);
|
||||||
m_max = maxVal;
|
|
||||||
::SendMessage(GetHwnd(), UDM_SETRANGE, 0,
|
::SendMessage(GetHwnd(), UDM_SETRANGE, 0,
|
||||||
(LPARAM) MAKELONG((short)maxVal, (short)minVal));
|
(LPARAM) MAKELONG((short)maxVal, (short)minVal));
|
||||||
}
|
}
|
||||||
@@ -188,12 +185,4 @@ bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spin event
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
|
||||||
|
|
||||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id)
|
|
||||||
: wxScrollEvent(commandType, id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __WIN95__
|
#endif // __WIN95__
|
||||||
|
Reference in New Issue
Block a user