wxMotif for OS/2 adjustements. Source cleaning.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35808 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-10-06 12:10:44 +00:00
parent 7fc65a0384
commit 355b4d3de5
23 changed files with 1516 additions and 294 deletions

1166
include/wx/motif/setup0.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -26,13 +26,25 @@
#include <os2def.h> #include <os2def.h>
#define I_NEED_OS2_H #define I_NEED_OS2_H
#include <X11/Xmd.h> #include <X11/Xmd.h>
#ifdef __cplusplus
extern "C" { // include this header from here for many of the GUI related code
#if wxUSE_GUI
extern "C" {
#include <Xm/VendorSP.h>
}
#endif #endif
#include <Xm/VendorSP.h>
#ifdef __cplusplus // provide Unix-like pipe()
#include <types.h>
#include <tcpustd.h>
#include <sys/time.h>
// Use ::DosCreatePipe or ::DosCreateNPipe under OS/2
// for more see http://posix2.sourceforge.net/guide.html
inline int pipe( int WXUNUSED(filedes)[2] )
{
wxFAIL_MSG(wxT("Implement first"));
return -1;
} }
#endif
#endif #endif
#if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA) #if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA)

View File

@@ -443,8 +443,8 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
xpoints[i].x = XLOG2DEV (points[i].x + xoffset); xpoints[i].x = (short)XLOG2DEV (points[i].x + xoffset);
xpoints[i].y = YLOG2DEV (points[i].y + yoffset); xpoints[i].y = (short)YLOG2DEV (points[i].y + yoffset);
} }
XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints, n, 0); XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints, n, 0);
@@ -452,8 +452,8 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord
{ {
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
xpoints[i].x = XLOG2DEV_2 (points[i].x + xoffset); xpoints[i].x = (short)XLOG2DEV_2 (points[i].x + xoffset);
xpoints[i].y = YLOG2DEV_2 (points[i].y + yoffset); xpoints[i].y = (short)YLOG2DEV_2 (points[i].y + yoffset);
} }
XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints, n, 0); XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints, n, 0);
} }
@@ -471,10 +471,10 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
xpoints1[i].x = XLOG2DEV (points[i].x + xoffset); xpoints1[i].x = (short)XLOG2DEV (points[i].x + xoffset);
xpoints1[i].y = YLOG2DEV (points[i].y + yoffset); xpoints1[i].y = (short)YLOG2DEV (points[i].y + yoffset);
xpoints2[i].x = XLOG2DEV_2 (points[i].x + xoffset); xpoints2[i].x = (short)XLOG2DEV_2 (points[i].x + xoffset);
xpoints2[i].y = YLOG2DEV_2 (points[i].y + yoffset); xpoints2[i].y = (short)YLOG2DEV_2 (points[i].y + yoffset);
CalcBoundingBox (points[i].x + xoffset, points[i].y + yoffset); CalcBoundingBox (points[i].x + xoffset, points[i].y + yoffset);
} }
@@ -1578,7 +1578,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
{ {
int factor = scaled_width == 0 ? 1 : scaled_width; int factor = scaled_width == 0 ? 1 : scaled_width;
for (int i = 0; i < req_nb_dash; i++) for (int i = 0; i < req_nb_dash; i++)
real_req_dash[i] = req_dash[i] * factor; real_req_dash[i] = (wxX11Dash)(req_dash[i] * factor);
XSetDashes ((Display*) m_display, (GC) m_gc, 0, real_req_dash, req_nb_dash); XSetDashes ((Display*) m_display, (GC) m_gc, 0, real_req_dash, req_nb_dash);
if (m_window && m_window->GetBackingPixmap()) if (m_window && m_window->GetBackingPixmap())
@@ -2072,10 +2072,10 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y,
if (m_window && m_window->GetBackingPixmap()) if (m_window && m_window->GetBackingPixmap())
{ {
XRectangle rects[1]; XRectangle rects[1];
rects[0].x = XLOG2DEV_2(x); rects[0].x = (short)XLOG2DEV_2(x);
rects[0].y = YLOG2DEV_2(y); rects[0].y = (short)YLOG2DEV_2(y);
rects[0].width = XLOG2DEVREL(width); rects[0].width = (unsigned short)XLOG2DEVREL(width);
rects[0].height = YLOG2DEVREL(height); rects[0].height = (unsigned short)YLOG2DEVREL(height);
XSetClipRectangles((Display*) m_display, (GC) m_gcBacking, XSetClipRectangles((Display*) m_display, (GC) m_gcBacking,
0, 0, rects, 1, Unsorted); 0, 0, rects, 1, Unsorted);
} }
@@ -2094,10 +2094,10 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region )
if (m_window && m_window->GetBackingPixmap()) if (m_window && m_window->GetBackingPixmap())
{ {
XRectangle rects[1]; XRectangle rects[1];
rects[0].x = XLOG2DEV_2(box.x); rects[0].x = (short)XLOG2DEV_2(box.x);
rects[0].y = YLOG2DEV_2(box.y); rects[0].y = (short)YLOG2DEV_2(box.y);
rects[0].width = XLOG2DEVREL(box.width); rects[0].width = (unsigned short)XLOG2DEVREL(box.width);
rects[0].height = YLOG2DEVREL(box.height); rects[0].height = (unsigned short)YLOG2DEVREL(box.height);
XSetClipRectangles((Display*) m_display, (GC) m_gcBacking, XSetClipRectangles((Display*) m_display, (GC) m_gcBacking,
0, 0, rects, 1, Unsorted); 0, 0, rects, 1, Unsorted);
} }

View File

@@ -113,32 +113,32 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
ChangeFont(false); ChangeFont(false);
// Can't remember what this was about... but I think it's necessary. // Can't remember what this was about... but I think it's necessary.
if (wxUSE_INVISIBLE_RESIZE) #if wxUSE_INVISIBLE_RESIZE
{ if (pos.x > -1)
if (pos.x > -1) XtVaSetValues(dialogShell, XmNx, pos.x,
XtVaSetValues(dialogShell, XmNx, pos.x, NULL);
NULL); if (pos.y > -1)
if (pos.y > -1) XtVaSetValues(dialogShell, XmNy, pos.y,
XtVaSetValues(dialogShell, XmNy, pos.y, NULL);
NULL);
if (size.x > -1) if (size.x > -1)
XtVaSetValues(dialogShell, XmNwidth, size.x, NULL); XtVaSetValues(dialogShell, XmNwidth, size.x, NULL);
if (size.y > -1) if (size.y > -1)
XtVaSetValues(dialogShell, XmNheight, size.y, NULL); XtVaSetValues(dialogShell, XmNheight, size.y, NULL);
} #endif
// Positioning of the dialog doesn't work properly unless the dialog // Positioning of the dialog doesn't work properly unless the dialog
// is managed, so we manage without mapping to the screen. // is managed, so we manage without mapping to the screen.
// To show, we map the shell (actually it's parent). // To show, we map the shell (actually it's parent).
if (!wxUSE_INVISIBLE_RESIZE) #if !wxUSE_INVISIBLE_RESIZE
XtVaSetValues(shell, XmNmappedWhenManaged, False, NULL); XtVaSetValues(shell, XmNmappedWhenManaged, False, NULL);
#endif
#if !wxUSE_INVISIBLE_RESIZE
XtManageChild(dialogShell);
SetSize(pos.x, pos.y, size.x, size.y);
#endif
if (!wxUSE_INVISIBLE_RESIZE)
{
XtManageChild(dialogShell);
SetSize(pos.x, pos.y, size.x, size.y);
}
XtAddEventHandler(dialogShell,ExposureMask,False, XtAddEventHandler(dialogShell,ExposureMask,False,
wxUniversalRepaintProc, (XtPointer) this); wxUniversalRepaintProc, (XtPointer) this);
@@ -148,11 +148,11 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
} }
bool wxDialog::XmDoCreateTLW(wxWindow* parent, bool wxDialog::XmDoCreateTLW(wxWindow* parent,
wxWindowID id, wxWindowID WXUNUSED(id),
const wxString& title, const wxString& WXUNUSED(title),
const wxPoint& pos, const wxPoint& WXUNUSED(pos),
const wxSize& size, const wxSize& WXUNUSED(size),
long style, long WXUNUSED(style),
const wxString& name) const wxString& name)
{ {
Widget parentWidget = (Widget) 0; Widget parentWidget = (Widget) 0;
@@ -224,10 +224,13 @@ wxDialog::~wxDialog()
} }
m_modalShowing = false; m_modalShowing = false;
if (!wxUSE_INVISIBLE_RESIZE && m_mainWidget)
#if !wxUSE_INVISIBLE_RESIZE
if (m_mainWidget)
{ {
XtUnmapWidget((Widget) m_mainWidget); XtUnmapWidget((Widget) m_mainWidget);
} }
#endif
PreDestroy(); PreDestroy();
@@ -299,10 +302,11 @@ bool wxDialog::Show( bool show )
if (show) if (show)
{ {
if (!wxUSE_INVISIBLE_RESIZE) #if !wxUSE_INVISIBLE_RESIZE
XtMapWidget(XtParent((Widget) m_mainWidget)); XtMapWidget(XtParent((Widget) m_mainWidget));
else #else
XtManageChild((Widget)m_mainWidget) ; XtManageChild((Widget)m_mainWidget) ;
#endif
XRaiseWindow( XtDisplay( (Widget)m_mainWidget ), XRaiseWindow( XtDisplay( (Widget)m_mainWidget ),
XtWindow( (Widget)m_mainWidget) ); XtWindow( (Widget)m_mainWidget) );
@@ -310,10 +314,11 @@ bool wxDialog::Show( bool show )
} }
else else
{ {
if (!wxUSE_INVISIBLE_RESIZE) #if !wxUSE_INVISIBLE_RESIZE
XtUnmapWidget(XtParent((Widget) m_mainWidget)); XtUnmapWidget(XtParent((Widget) m_mainWidget));
else #else
XtUnmanageChild((Widget)m_mainWidget) ; XtUnmanageChild((Widget)m_mainWidget) ;
#endif
XFlush(XtDisplay((Widget)m_mainWidget)); XFlush(XtDisplay((Widget)m_mainWidget));
XSync(XtDisplay((Widget)m_mainWidget), False); XSync(XtDisplay((Widget)m_mainWidget), False);

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Name: motif/evtloop.cpp // Name: src/motif/evtloop.cpp
// Purpose: implements wxEventLoop for Motif // Purpose: implements wxEventLoop for Motif
// Author: Mattia Barbon // Author: Mattia Barbon
// Modified by: // Modified by:
@@ -257,7 +257,7 @@ bool CheckForAccelerator(XEvent* event)
wxWindow* win = NULL; wxWindow* win = NULL;
// Find the first wxWindow that corresponds to this event window // Find the first wxWindow that corresponds to this event window
while (widget && !(win = wxGetWindowFromTable(widget))) while (widget && ((win = wxGetWindowFromTable(widget))!=NULL))
widget = XtParent(widget); widget = XtParent(widget);
if (!widget || !win) if (!widget || !win)
@@ -291,7 +291,7 @@ bool CheckForKeyDown(XEvent* event)
wxWindow* win = NULL; wxWindow* win = NULL;
// Find the first wxWindow that corresponds to this event window // Find the first wxWindow that corresponds to this event window
while (widget && !(win = wxGetWindowFromTable(widget))) while (widget && ((win = wxGetWindowFromTable(widget))!=NULL))
widget = XtParent(widget); widget = XtParent(widget);
if (!widget || !win) if (!widget || !win)
@@ -317,7 +317,7 @@ bool CheckForKeyUp(XEvent* event)
wxWindow* win = NULL; wxWindow* win = NULL;
// Find the first wxWindow that corresponds to this event window // Find the first wxWindow that corresponds to this event window
while (widget && !(win = wxGetWindowFromTable(widget))) while (widget && ((win = wxGetWindowFromTable(widget))!=NULL))
widget = XtParent(widget); widget = XtParent(widget);
if (!widget || !win) if (!widget || !win)
@@ -472,7 +472,7 @@ bool wxAddIdleCallback()
{ {
if (!wxInitIdleFds()) if (!wxInitIdleFds())
return false; return false;
// install input handler for wxWakeUpIdle // install input handler for wxWakeUpIdle
XtAppAddInput((XtAppContext) wxTheApp->GetAppContext(), XtAppAddInput((XtAppContext) wxTheApp->GetAppContext(),
idleFds[0], idleFds[0],

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: motif/frame.cpp // Name: src/motif/frame.cpp
// Purpose: wxFrame // Purpose: wxFrame
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -184,7 +184,8 @@ bool wxFrame::Create(wxWindow *parent,
PreResize(); PreResize();
wxSizeEvent sizeEvent(wxSize(width, height), GetId()); wxSize newSize(width, height);
wxSizeEvent sizeEvent(newSize, GetId());
sizeEvent.SetEventObject(this); sizeEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(sizeEvent); GetEventHandler()->ProcessEvent(sizeEvent);
@@ -192,11 +193,11 @@ bool wxFrame::Create(wxWindow *parent,
return true; return true;
} }
bool wxFrame::XmDoCreateTLW(wxWindow* parent, bool wxFrame::XmDoCreateTLW(wxWindow* WXUNUSED(parent),
wxWindowID id, wxWindowID WXUNUSED(id),
const wxString& title, const wxString& WXUNUSED(title),
const wxPoint& pos, const wxPoint& WXUNUSED(pos),
const wxSize& size, const wxSize& WXUNUSED(size),
long style, long style,
const wxString& name) const wxString& name)
{ {
@@ -330,7 +331,7 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
{ {
int sbw, sbh; int sbw, sbh;
m_frameStatusBar->GetSize(& sbw, & sbh); m_frameStatusBar->GetSize(& sbw, & sbh);
yy -= sbh; yy = (Dimension)(yy - sbh);
} }
#if wxUSE_TOOLBAR #if wxUSE_TOOLBAR
if (m_frameToolBar) if (m_frameToolBar)
@@ -338,9 +339,9 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
int tbw, tbh; int tbw, tbh;
m_frameToolBar->GetSize(& tbw, & tbh); m_frameToolBar->GetSize(& tbw, & tbh);
if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL) if (m_frameToolBar->GetWindowStyleFlag() & wxTB_VERTICAL)
xx -= tbw; xx = (Dimension)(xx - tbw);
else else
yy -= tbh; yy = (Dimension)(yy - tbh);
} }
#endif // wxUSE_TOOLBAR #endif // wxUSE_TOOLBAR
@@ -385,7 +386,8 @@ void wxFrame::DoSetClientSize(int width, int height)
} }
PreResize(); PreResize();
wxSizeEvent sizeEvent(wxSize(width, height), GetId()); wxSize newSize(width, height);
wxSizeEvent sizeEvent(newSize, GetId());
sizeEvent.SetEventObject(this); sizeEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(sizeEvent); GetEventHandler()->ProcessEvent(sizeEvent);

View File

@@ -1,12 +1,12 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: gauge.cpp // Name: src/motif/gauge.cpp
// Purpose: wxGauge class // Purpose: wxGauge class
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
// 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
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
@@ -24,6 +24,10 @@
# include "wx/gauge.h" # include "wx/gauge.h"
#ifdef __OS2__
#include <types.h>
#endif
#ifdef __VMS__ #ifdef __VMS__
#pragma message disable nosimpint #pragma message disable nosimpint
#endif #endif
@@ -67,8 +71,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
*/ */
//// PUBLIC XMGAUGE DECLARATIONS //// PUBLIC XMGAUGE DECLARATIONS
typedef struct _XmGaugeClassRec* XmGaugeWidgetClass; typedef struct _XmGaugeClassRec* XmGaugeWidgetClass;
typedef struct _XmGaugeRec* XmGaugeWidget; typedef struct _XmGaugeRec* XmGaugeWidget;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" WidgetClass xmGaugeWidgetClass; extern "C" WidgetClass xmGaugeWidgetClass;
@@ -217,9 +221,9 @@ typedef struct {
} 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;
} XmGaugeClassRec; } XmGaugeClassRec;
@@ -234,16 +238,16 @@ typedef struct _XmGaugePart{
XtCallbackList valueChangedCallback; XtCallbackList valueChangedCallback;
/* private fields */ /* private fields */
Boolean dragging; /* drag in progress ? */ Boolean dragging; /* drag in progress ? */
int oldx, oldy; int oldx, oldy;
GC gc; GC gc;
} XmGaugePart; } XmGaugePart;
typedef struct _XmGaugeRec { typedef struct _XmGaugeRec {
CorePart core; CorePart core;
XmPrimitivePart primitive; XmPrimitivePart primitive;
XmGaugePart gauge; XmGaugePart gauge;
} XmGaugeRec; } XmGaugeRec;
extern XmGaugeClassRec xmGaugeClassRec; extern XmGaugeClassRec xmGaugeClassRec;
@@ -404,7 +408,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
} }
switch(THIS.orientation) { switch(THIS.orientation) {
case XmHORIZONTAL: case XmHORIZONTAL:
/* size = (gw->core.width - 2 * sht) / ratio; */ /* size = (gw->core.width - 2 * sht) / ratio; */
/* A fix suggested by Dmitri Chubraev */ /* A fix suggested by Dmitri Chubraev */
size = (gw->core.width - 2 * sht) /((float)THIS.maximum-(float)THIS.minimum)*(float)THIS.value; size = (gw->core.width - 2 * sht) /((float)THIS.maximum-(float)THIS.minimum)*(float)THIS.value;
switch(THIS.processingDirection) { switch(THIS.processingDirection) {
@@ -423,7 +427,7 @@ DrawSlider(XmGaugeWidget gw, Boolean clear)
break; break;
case XmVERTICAL: case XmVERTICAL:
size = (gw->core.height - 2 * sht) /((float)THIS.maximum-(float)THIS.minimum)*(float)THIS.value; size = (gw->core.height - 2 * sht) /((float)THIS.maximum-(float)THIS.minimum)*(float)THIS.value;
/* size = (gw->core.height - 2 * sht)/ ratio; */ /* size = (gw->core.height - 2 * sht)/ ratio; */
switch(THIS.processingDirection) { switch(THIS.processingDirection) {
case XmMAX_ON_RIGHT: case XmMAX_ON_RIGHT:
case XmMAX_ON_BOTTOM: case XmMAX_ON_BOTTOM:
@@ -511,7 +515,7 @@ ExposeProc(Widget w, XEvent *WXUNUSED(event), Region WXUNUSED(r))
gw->primitive.top_shadow_GC, gw->primitive.top_shadow_GC,
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); (Dimension)sht, XmSHADOW_IN);
DrawSlider(gw, False); DrawSlider(gw, False);
#undef THIS #undef THIS
} }
@@ -551,53 +555,53 @@ resources[] = {
XmGaugeClassRec xmGaugeClassRec = { XmGaugeClassRec xmGaugeClassRec = {
{ /* core fields */ { /* core fields */
(WidgetClass) &xmPrimitiveClassRec, /* superclass */ (WidgetClass) &xmPrimitiveClassRec, /* superclass */
"XmGauge", /* class_name */ "XmGauge", /* class_name */
sizeof(XmGaugeRec), /* widget_size */ sizeof(XmGaugeRec), /* widget_size */
NULL, /* class_initialize */ NULL, /* class_initialize */
NULL, /* class_part_initialize */ NULL, /* class_part_initialize */
False, /* class_inited */ False, /* class_inited */
Initialize, /* initialize */ Initialize, /* initialize */
NULL, /* initialize_hook */ NULL, /* initialize_hook */
XtInheritRealize, /* realize */ XtInheritRealize, /* realize */
actions, /* actions */ actions, /* actions */
XtNumber(actions), /* num_actions */ XtNumber(actions), /* num_actions */
resources, /* resources */ resources, /* resources */
XtNumber(resources), /* num_resources */ XtNumber(resources), /* num_resources */
NULLQUARK, /* xrm_class */ NULLQUARK, /* xrm_class */
True, /* compress_motion */ True, /* compress_motion */
True, /* compress_exposure */ True, /* compress_exposure */
True, /* compress_enterleave */ True, /* compress_enterleave */
False, /* visible_interest */ False, /* visible_interest */
Destroy, /* destroy */ Destroy, /* destroy */
NULL, /* resize */ NULL, /* resize */
ExposeProc, /* expose */ ExposeProc, /* expose */
SetValues, /* set_values */ SetValues, /* set_values */
NULL, /* set_values_hook */ NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */ XtInheritSetValuesAlmost, /* set_values_almost */
NULL, /* get_values_hook */ NULL, /* get_values_hook */
NULL, /* accept_focus */ NULL, /* accept_focus */
XtVersion, /* version */ XtVersion, /* version */
NULL, /* callback_private */ NULL, /* callback_private */
translations, /* tm_table */ translations, /* tm_table */
NULL, /* query_geometry */ NULL, /* query_geometry */
NULL, /* display_accelerator */ NULL, /* display_accelerator */
NULL /* extension */ NULL /* extension */
}, },
/* primitive_class fields */ /* primitive_class fields */
{ {
NULL, /* border_highlight */ NULL, /* border_highlight */
NULL, /* border_unhighlight */ NULL, /* border_unhighlight */
NULL, /* translations */ NULL, /* translations */
NULL, /* arm_and_activate */ NULL, /* arm_and_activate */
NULL, /* syn_resources */ NULL, /* syn_resources */
0, /* num_syn_resources */ 0, /* num_syn_resources */
NULL /* extension */ NULL /* extension */
}, },
{ /* gauge fields */ { /* gauge fields */
0 /* empty */ 0 /* empty */
} }
}; };
WidgetClass xmGaugeWidgetClass = (WidgetClass)&xmGaugeClassRec; WidgetClass xmGaugeWidgetClass = (WidgetClass)&xmGaugeClassRec;

View File

@@ -1,14 +1,18 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: gdiobj.cpp // Name: src/motif/gdiobj.cpp
// Purpose: wxGDIObject class // Purpose: wxGDIObject class
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
// 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
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/gdiobj.h" #include "wx/gdiobj.h"
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)

View File

@@ -1,12 +1,13 @@
/* ------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////
* Project: GSocket (Generic Socket) for WX // Name: src/motif/gsockmot.cpp
* Name: gsockmot.c // Project: GSocket (Generic Socket) for WX
* Purpose: GSocket: Motif part // Purpose: GSocket: Motif part
* CVSID: $Id$ // CVSID: $Id$
* Licence: The wxWindows licence // Licence: wxWindows licence
* ------------------------------------------------------------------------- */ /////////////////////////////////////////////////////////////////////////////
#include "wx/setup.h" // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_SOCKETS #if wxUSE_SOCKETS
@@ -17,24 +18,26 @@
extern "C" XtAppContext wxGetAppContext(); extern "C" XtAppContext wxGetAppContext();
static void _GSocket_Motif_Input(XtPointer data, int *fid, static void _GSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid),
XtInputId *id) XtInputId *WXUNUSED(id))
{ {
GSocket *socket = (GSocket *)data; GSocket *socket = (GSocket *)data;
socket->Detected_Read(); socket->Detected_Read();
} }
static void _GSocket_Motif_Output(XtPointer data, int *fid, static void _GSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid),
XtInputId *id) XtInputId *WXUNUSED(id))
{ {
GSocket *socket = (GSocket *)data; GSocket *socket = (GSocket *)data;
socket->Detected_Write(); socket->Detected_Write();
} }
bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop()
{ return true; } {
return true;
}
bool GSocketGUIFunctionsTableConcrete::OnInit(void) bool GSocketGUIFunctionsTableConcrete::OnInit(void)
{ {
@@ -47,88 +50,88 @@ void GSocketGUIFunctionsTableConcrete::OnExit(void)
bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket) bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket)
{ {
int *m_id; int *m_id;
socket->m_gui_dependent = (char *)malloc(sizeof(int)*2); socket->m_gui_dependent = (char *)malloc(sizeof(int)*2);
m_id = (int *)(socket->m_gui_dependent); m_id = (int *)(socket->m_gui_dependent);
m_id[0] = -1; m_id[0] = -1;
m_id[1] = -1; m_id[1] = -1;
return true; return true;
} }
void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket)
{ {
free(socket->m_gui_dependent); free(socket->m_gui_dependent);
} }
void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket, GSocketEvent event) void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket, GSocketEvent event)
{ {
int *m_id = (int *)(socket->m_gui_dependent); int *m_id = (int *)(socket->m_gui_dependent);
int c; int c;
if (socket->m_fd == -1) if (socket->m_fd == -1)
return; return;
switch (event) switch (event)
{ {
case GSOCK_LOST: /* fall-through */ case GSOCK_LOST: /* fall-through */
case GSOCK_INPUT: c = 0; break; case GSOCK_INPUT: c = 0; break;
case GSOCK_OUTPUT: c = 1; break; case GSOCK_OUTPUT: c = 1; break;
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
default: return; default: return;
} }
if (m_id[c] != -1) if (m_id[c] != -1)
XtRemoveInput(m_id[c]); XtRemoveInput(m_id[c]);
if (c == 0) if (c == 0)
{ {
m_id[0] = XtAppAddInput(wxGetAppContext(), socket->m_fd, m_id[0] = XtAppAddInput(wxGetAppContext(), socket->m_fd,
(XtPointer *)XtInputReadMask, (XtPointer *)XtInputReadMask,
(XtInputCallbackProc) _GSocket_Motif_Input, (XtInputCallbackProc) _GSocket_Motif_Input,
(XtPointer) socket); (XtPointer) socket);
} }
else else
{ {
m_id[1] = XtAppAddInput(wxGetAppContext(), socket->m_fd, m_id[1] = XtAppAddInput(wxGetAppContext(), socket->m_fd,
(XtPointer *)XtInputWriteMask, (XtPointer *)XtInputWriteMask,
(XtInputCallbackProc) _GSocket_Motif_Output, (XtInputCallbackProc) _GSocket_Motif_Output,
(XtPointer) socket); (XtPointer) socket);
} }
} }
void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket, GSocketEvent event) void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket, GSocketEvent event)
{ {
int *m_id = (int *)(socket->m_gui_dependent); int *m_id = (int *)(socket->m_gui_dependent);
int c; int c;
switch (event) switch (event)
{ {
case GSOCK_LOST: /* fall-through */ case GSOCK_LOST: /* fall-through */
case GSOCK_INPUT: c = 0; break; case GSOCK_INPUT: c = 0; break;
case GSOCK_OUTPUT: c = 1; break; case GSOCK_OUTPUT: c = 1; break;
case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break;
default: return; default: return;
} }
if (m_id[c] != -1) if (m_id[c] != -1)
XtRemoveInput(m_id[c]); XtRemoveInput(m_id[c]);
m_id[c] = -1; m_id[c] = -1;
} }
void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket) void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket)
{ {
Install_Callback(socket, GSOCK_INPUT); Install_Callback(socket, GSOCK_INPUT);
Install_Callback(socket, GSOCK_OUTPUT); Install_Callback(socket, GSOCK_OUTPUT);
} }
void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket) void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket)
{ {
Uninstall_Callback(socket, GSOCK_INPUT); Uninstall_Callback(socket, GSOCK_INPUT);
Uninstall_Callback(socket, GSOCK_OUTPUT); Uninstall_Callback(socket, GSOCK_OUTPUT);
} }
#else /* !wxUSE_SOCKETS */ #else /* !wxUSE_SOCKETS */

View File

@@ -1,12 +1,12 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: icon.cpp // Name: src/motif/icon.cpp
// Purpose: wxIcon class // Purpose: wxIcon class
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
// 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
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
@@ -57,7 +57,7 @@ bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
UnRef(); UnRef();
wxBitmapHandler *handler = FindHandler(type); wxBitmapHandler *handler = FindHandler(type);
if ( handler ) if ( handler )
return handler->LoadFile(this, filename, type, return handler->LoadFile(this, filename, type,
desiredWidth, desiredHeight); desiredWidth, desiredHeight);

View File

@@ -306,7 +306,7 @@ int wxDoFindStringInList(Widget w, const wxString& s)
return -1; return -1;
} }
int wxListBox::FindString(const wxString& s, bool bCase) const int wxListBox::FindString(const wxString& s, bool WXUNUSED(bCase)) const
{ {
// FIXME: back to base class for not supported value of bCase // FIXME: back to base class for not supported value of bCase

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: menu.cpp // Name: src/motif/menu.cpp
// Purpose: wxMenu, wxMenuBar, wxMenuItem // Purpose: wxMenu, wxMenuBar, wxMenuItem
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -140,7 +140,7 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
item->GetSubMenu()->m_topLevelMenu = m_topLevelMenu; item->GetSubMenu()->m_topLevelMenu = m_topLevelMenu;
} }
return pos == GetMenuItemCount() ? wxMenuBase::DoAppend(item) : return pos == GetMenuItemCount() ? wxMenuBase::DoAppend(item) :
wxMenuBase::DoInsert(pos, item); wxMenuBase::DoInsert(pos, item);
} }
@@ -338,12 +338,14 @@ wxMenuItem *wxMenuBar::FindItem(int id, wxMenu ** itemMenu) const
if (itemMenu) if (itemMenu)
*itemMenu = NULL; *itemMenu = NULL;
wxMenuItem *item = NULL;
size_t menuCount = GetMenuCount(); size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++) for (size_t i = 0; i < menuCount; i++)
if ((item = m_menus.Item(i)->GetData()->FindItem(id, itemMenu))) {
return item; wxMenuItem *item = m_menus.Item(i)->GetData()->FindItem(id, itemMenu);
return NULL; if (item) return item;
}
return NULL;
} }
// Create menubar // Create menubar
@@ -465,7 +467,12 @@ void wxMenu::DestroyWidgetAndDetach()
* *
*/ */
WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topMenu, size_t index, const wxString& title, bool pullDown) WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar,
WXWidget parent,
wxMenu * topMenu,
size_t WXUNUSED(index),
const wxString& title,
bool pullDown)
{ {
Widget menu = (Widget) 0; Widget menu = (Widget) 0;
Widget buttonWidget = (Widget) 0; Widget buttonWidget = (Widget) 0;
@@ -671,6 +678,8 @@ void wxMenu::ChangeFont(bool keepOriginalSize)
if (item->GetSubMenu()) if (item->GetSubMenu())
item->GetSubMenu()->ChangeFont(keepOriginalSize); item->GetSubMenu()->ChangeFont(keepOriginalSize);
} }
#else
wxUnusedVar(keepOriginalSize);
#endif #endif
} }

View File

@@ -1,14 +1,17 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: minifram.cpp // Name: src/motif/minifram.cpp
// Purpose: wxMiniFrame. Optional; identical to wxFrame if not supported. // Purpose: wxMiniFrame. Optional; identical to wxFrame if not supported.
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
// 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
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/minifram.h" #include "wx/minifram.h"
IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame) IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame)

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: palette.cpp // Name: src/motif/palette.cpp
// Purpose: wxPalette // Purpose: wxPalette
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -147,9 +147,9 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
pix_array_n = n; pix_array_n = n;
xcol.flags = DoRed | DoGreen | DoBlue; xcol.flags = DoRed | DoGreen | DoBlue;
for(int i = 0; i < n; i++) { for(int i = 0; i < n; i++) {
xcol.red = (unsigned short)red[i] << 8; xcol.red = (unsigned short)(red[i] << 8);
xcol.green = (unsigned short)green[i] << 8; xcol.green = (unsigned short)(green[i] << 8);
xcol.blue = (unsigned short)blue[i] << 8; xcol.blue = (unsigned short)(blue[i] << 8);
pix_array[i] = (XAllocColor(display, cmap, &xcol) == 0) ? 0 : xcol.pixel; pix_array[i] = (XAllocColor(display, cmap, &xcol) == 0) ? 0 : xcol.pixel;
} }
@@ -165,7 +165,9 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
return true; return true;
} }
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const int wxPalette::GetPixel(const unsigned char WXUNUSED(red),
const unsigned char WXUNUSED(green),
const unsigned char WXUNUSED(blue)) const
{ {
if ( !m_refData ) if ( !m_refData )
return false; return false;
@@ -290,9 +292,9 @@ bool wxPalette::TransferBitmap8(unsigned char *data, unsigned long sz,
struct rgb24 { unsigned char r, g, b; } *dptr = (struct rgb24 *)dest; struct rgb24 { unsigned char r, g, b; } *dptr = (struct rgb24 *)dest;
while(sz-- > 0) { while(sz-- > 0) {
if((int)*data < pix_array_n) { if((int)*data < pix_array_n) {
dptr->r = pix_array[*data] & 0xFF; dptr->r = (unsigned char)(pix_array[*data] & 0xFF);
dptr->g = (pix_array[*data] >> 8) & 0xFF; dptr->g = (unsigned char)((pix_array[*data] >> 8) & 0xFF);
dptr->b = (pix_array[*data] >> 16) & 0xFF; dptr->b = (unsigned char)((pix_array[*data] >> 16) & 0xFF);
} }
data++; data++;
dptr++; dptr++;

View File

@@ -1,12 +1,12 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: radiobut.cpp // Name: src/motif/radiobut.cpp
// Purpose: wxRadioButton // Purpose: wxRadioButton
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
// 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
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
@@ -147,7 +147,7 @@ void wxRadioButton::ChangeBackgroundColour()
NULL); NULL);
} }
void wxRadioButtonCallback (Widget w, XtPointer clientData, void wxRadioButtonCallback (Widget WXUNUSED(w), XtPointer clientData,
XmToggleButtonCallbackStruct * cbs) XmToggleButtonCallbackStruct * cbs)
{ {
if (!cbs->set) if (!cbs->set)

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: scrolbar.cpp // Name: src/motif/scrolbar.cpp
// Purpose: wxScrollBar // Purpose: wxScrollBar
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: motif/settings.cpp // Name: src/motif/settings.cpp
// Purpose: wxSettings // Purpose: wxSettings
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -41,7 +41,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
if (NULL == but_setting_wid && wxTheApp && wxTheApp->GetTopLevelWidget()) if (NULL == but_setting_wid && wxTheApp && wxTheApp->GetTopLevelWidget())
{ {
but_setting_wid = XtVaCreateWidget("settings_button", xmPushButtonWidgetClass, but_setting_wid = XtVaCreateWidget("settings_button", xmPushButtonWidgetClass,
(Widget)wxTheApp->GetTopLevelWidget(), NULL); (Widget)wxTheApp->GetTopLevelWidget(), NULL);
} }
switch (index) switch (index)
@@ -70,7 +70,9 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
XtVaGetValues(but_setting_wid, XtVaGetValues(but_setting_wid,
XtVaTypedArg, XmNbackground, XtRColor, &bg, sizeof(bg), XtVaTypedArg, XmNbackground, XtRColor, &bg, sizeof(bg),
NULL); NULL);
return wxColor(bg.red >> 8, bg.green >> 8, bg.blue >> 8); return wxColor((unsigned char)(bg.red >> 8),
(unsigned char)(bg.green >> 8),
(unsigned char)(bg.blue >> 8));
} }
else else
{ {
@@ -113,7 +115,9 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
XtVaGetValues(but_setting_wid, XtVaGetValues(but_setting_wid,
XtVaTypedArg, XmNforeground, XtRColor, &fg, sizeof(fg), XtVaTypedArg, XmNforeground, XtRColor, &fg, sizeof(fg),
NULL); NULL);
return wxColor(fg.red >> 8, fg.green >> 8, fg.blue >> 8); return wxColor((unsigned char)(fg.red >> 8),
(unsigned char)(fg.green >> 8),
(unsigned char)(fg.blue >> 8));
} }
else else
{ {
@@ -133,7 +137,9 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
XtVaGetValues(but_setting_wid, XtVaGetValues(but_setting_wid,
XtVaTypedArg, XmNbackground, XtRColor, &bg, sizeof(bg), XtVaTypedArg, XmNbackground, XtRColor, &bg, sizeof(bg),
NULL); NULL);
return wxColor(bg.red >> 8, bg.green >> 8, bg.blue >> 8); return wxColor((unsigned char)(bg.red >> 8),
(unsigned char)(bg.green >> 8),
(unsigned char)(bg.blue >> 8));
} }
else else
{ {
@@ -163,11 +169,13 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|| wxFont::GetDefaultEncoding() == wxFONTENCODING_EUC_JP) || wxFont::GetDefaultEncoding() == wxFONTENCODING_EUC_JP)
pointSize = 15; pointSize = 15;
wxFont font;
switch (index) switch (index)
{ {
case wxSYS_SYSTEM_FIXED_FONT: case wxSYS_SYSTEM_FIXED_FONT:
{ {
return wxFont(pointSize, wxMODERN, wxNORMAL, wxNORMAL, false); font = wxFont(pointSize, wxMODERN, wxNORMAL, wxNORMAL, false);
break; break;
} }
case wxSYS_DEVICE_DEFAULT_FONT: case wxSYS_DEVICE_DEFAULT_FONT:
@@ -175,12 +183,12 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
case wxSYS_DEFAULT_GUI_FONT: case wxSYS_DEFAULT_GUI_FONT:
default: default:
{ {
return wxFont(pointSize, wxSWISS, wxNORMAL, wxNORMAL, false); font = wxFont(pointSize, wxSWISS, wxNORMAL, wxNORMAL, false);
break; break;
} }
} }
return wxFont(); return font;
} }
// Get a system metric, e.g. scrollbar size // Get a system metric, e.g. scrollbar size
@@ -193,7 +201,7 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w
case wxSYS_HSCROLL_Y: case wxSYS_HSCROLL_Y:
case wxSYS_VSCROLL_X: case wxSYS_VSCROLL_X:
return 15; return 15;
case wxSYS_SCREEN_X: case wxSYS_SCREEN_X:
return_value = DisplayWidth( wxGlobalDisplay(), 0 ); return_value = DisplayWidth( wxGlobalDisplay(), 0 );
break; break;

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: spinbutt.cpp // Name: src/motif/spinbutt.cpp
// Purpose: wxSpinButton // Purpose: wxSpinButton
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -182,7 +182,8 @@ void wxArrowButton::StopTimerCallback( Widget w, XtPointer clientData,
btn->m_timer = 0; btn->m_timer = 0;
} }
bool wxArrowButton::Create( wxSpinButton* parent, wxWindowID id, bool wxArrowButton::Create( wxSpinButton* parent,
wxWindowID WXUNUSED(id),
ArrowDirection d, ArrowDirection d,
const wxPoint& pos, const wxSize& size ) const wxPoint& pos, const wxSize& size )
{ {

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: textctrl.cpp // Name: src/motif/textctrl.cpp
// Purpose: wxTextCtrl // Purpose: wxTextCtrl
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -136,7 +136,7 @@ bool wxTextCtrl::Create(wxWindow *parent,
XtSetArg (args[count], (String) wxFont::GetFontTag(), XtSetArg (args[count], (String) wxFont::GetFontTag(),
m_font.GetFontType( XtDisplay(parentWidget) ) ); ++count; m_font.GetFontType( XtDisplay(parentWidget) ) ); ++count;
XtSetArg (args[count], XmNwordWrap, wantWordWrap); ++count; XtSetArg (args[count], XmNwordWrap, wantWordWrap); ++count;
XtSetArg (args[count], XmNvalue, value.c_str()); ++count; XtSetArg (args[count], XmNvalue, value.c_str()); ++count;
XtSetArg (args[count], XmNeditable, XtSetArg (args[count], XmNeditable,
style & wxTE_READONLY ? False : True); ++count; style & wxTE_READONLY ? False : True); ++count;
XtSetArg (args[count], XmNeditMode, XmMULTI_LINE_EDIT ); ++count; XtSetArg (args[count], XmNeditMode, XmMULTI_LINE_EDIT ); ++count;
@@ -249,7 +249,7 @@ void wxTextCtrl::SetValue(const wxString& text)
SetInsertionPoint(text.length()); SetInsertionPoint(text.length());
XmTextShowPosition ((Widget) m_mainWidget, text.length()); XmTextShowPosition ((Widget) m_mainWidget, text.length());
m_modified = TRUE; m_modified = true;
m_inSetValue = false; m_inSetValue = false;
} }
@@ -498,7 +498,7 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
if (s) if (s)
{ {
wxString buf(""); wxString buf;
long i; long i;
int currentLine = 0; int currentLine = 0;
for (i = 0; currentLine != lineNo && s[i]; i++ ) for (i = 0; currentLine != lineNo && s[i]; i++ )
@@ -549,7 +549,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
textStruct->doit = True; textStruct->doit = True;
if (isascii(event.m_keyCode) && (textStruct->text->length == 1)) if (isascii(event.m_keyCode) && (textStruct->text->length == 1))
{ {
textStruct->text->ptr[0] = ((event.m_keyCode == WXK_RETURN) ? 10 : event.m_keyCode); textStruct->text->ptr[0] = (char)((event.m_keyCode == WXK_RETURN) ? 10 : event.m_keyCode);
} }
} }
} }

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: motif/toolbar.cpp // Name: src/motif/toolbar.cpp
// Purpose: wxToolBar // Purpose: wxToolBar
// Author: Julian Smart // Author: Julian Smart
// Modified by: 13.12.99 by VZ during toolbar classes reorganization // Modified by: 13.12.99 by VZ during toolbar classes reorganization
@@ -417,7 +417,7 @@ bool wxToolBar::Realize()
(Pixmap)tmp.GetDrawable() : (Pixmap)tmp.GetDrawable() :
tool->GetInsensPixmap(); tool->GetInsensPixmap();
} }
if (tool->CanBeToggled()) if (tool->CanBeToggled())
{ {
// Toggle button // Toggle button
@@ -492,7 +492,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
return true; return true;
} }
bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
{ {
tool->Detach(); tool->Detach();
@@ -516,7 +516,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
offset = isVertical ? size.y : size.x; offset = isVertical ? size.y : size.x;
offset += packing; offset += packing;
break; break;
} }
case wxTOOL_STYLE_SEPARATOR: case wxTOOL_STYLE_SEPARATOR:
offset = isVertical ? 0 : separatorSize; offset = isVertical ? 0 : separatorSize;
break; break;
@@ -542,14 +542,14 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
{ {
case wxTOOL_STYLE_CONTROL: case wxTOOL_STYLE_CONTROL:
{ {
wxPoint pos = t->GetControl()->GetPosition(); wxPoint location = t->GetControl()->GetPosition();
if( isVertical ) if( isVertical )
pos.y -= offset; location.y -= offset;
else else
pos.x -= offset; location.x -= offset;
t->GetControl()->Move( pos ); t->GetControl()->Move( location );
break; break;
} }
case wxTOOL_STYLE_SEPARATOR: case wxTOOL_STYLE_SEPARATOR:
@@ -563,9 +563,9 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
NULL ); NULL );
if( isVertical ) if( isVertical )
y -= offset; y = (Dimension)(y - offset);
else else
x -= offset; x = (Dimension)(x - offset);
XtVaSetValues( t->GetButtonWidget(), XtVaSetValues( t->GetButtonWidget(),
XmNx, x, XmNx, x,
@@ -621,12 +621,12 @@ void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags)
} }
wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags); wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags);
// We must refresh the frame size when the toolbar changes size // We must refresh the frame size when the toolbar changes size
// otherwise the toolbar can be shown incorrectly // otherwise the toolbar can be shown incorrectly
if ( old_width != width || old_height != height ) if ( old_width != width || old_height != height )
{ {
// But before we send the size event check it // But before we send the size event check it
// we have a frame that is not being deleted. // we have a frame that is not being deleted.
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
if ( frame && !frame->IsBeingDeleted() ) if ( frame && !frame->IsBeingDeleted() )
@@ -754,7 +754,7 @@ void wxToolBarTimer::Notify()
// Move the tooltip more or less above the button // Move the tooltip more or less above the button
int yOffset = 20; // TODO: What should be really? int yOffset = 20; // TODO: What should be really?
y -= yOffset; y = (Position)(y - yOffset);
if (y < yOffset) y = 0; if (y < yOffset) y = 0;
/************************************************************/ /************************************************************/

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: motif/toplevel.cpp // Name: src/motif/toplevel.cpp
// Purpose: wxTopLevelWindow Motif implementation // Purpose: wxTopLevelWindow Motif implementation
// Author: Mattia Barbon // Author: Mattia Barbon
// Modified by: // Modified by:
@@ -270,8 +270,8 @@ WXWidget wxTopLevelWindowMotif::GetShellWidget() const
return (WXWidget) GetShell( this ); return (WXWidget) GetShell( this );
} }
bool wxTopLevelWindowMotif::ShowFullScreen( bool show, bool wxTopLevelWindowMotif::ShowFullScreen( bool WXUNUSED(show),
long style ) long WXUNUSED(style) )
{ {
// TODO, see wxGTK // TODO, see wxGTK
return false; return false;
@@ -318,7 +318,7 @@ bool wxTopLevelWindowMotif::IsIconized() const
XmNiconic, &iconic, XmNiconic, &iconic,
NULL ); NULL );
return iconic; return (iconic == True);
} }
void wxTopLevelWindowMotif::Maximize( bool maximize ) void wxTopLevelWindowMotif::Maximize( bool maximize )

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: utils.cpp // Name: src/motif/utils.cpp
// Purpose: Various utilities // Purpose: Various utilities
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -180,7 +180,7 @@ static char * GetIniFile (char *dest, const char *filename)
{ {
strcpy(dest, filename); strcpy(dest, filename);
} }
else if ((home = wxGetUserHome("")) != NULL) else if ((home = wxGetUserHome()) != NULL)
{ {
strcpy(dest, home); strcpy(dest, home);
if (dest[strlen(dest) - 1] != '/') if (dest[strlen(dest) - 1] != '/')
@@ -314,7 +314,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
XrmDatabase database; XrmDatabase database;
if (file != "") if (!file.empty())
{ {
char buffer[500]; char buffer[500];
@@ -454,7 +454,7 @@ void wxXMergeDatabases (wxApp * theApp, Display * display)
environment = GetIniFile (filename, NULL); environment = GetIniFile (filename, NULL);
len = strlen (environment); len = strlen (environment);
wxString hostname = wxGetHostName(); wxString hostname = wxGetHostName();
if ( !!hostname ) if ( !hostname.empty() )
strncat(environment, hostname, 1024 - len); strncat(environment, hostname, 1024 - len);
} }
homeDB = XrmGetFileDatabase (environment); homeDB = XrmGetFileDatabase (environment);
@@ -667,9 +667,9 @@ void wxHSVToXColor(wxHSV *hsv,XColor *rgb)
case 4: r = t, g = p, b = v; break; case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break; case 5: r = v, g = p, b = q; break;
} }
rgb->red = r << 8; rgb->red = (unsigned short)(r << 8);
rgb->green = g << 8; rgb->green = (unsigned short)(g << 8);
rgb->blue = b << 8; rgb->blue = (unsigned short)(b << 8);
} }
void wxXColorToHSV(wxHSV *hsv,XColor *rgb) void wxXColorToHSV(wxHSV *hsv,XColor *rgb)
@@ -811,6 +811,7 @@ char wxFindMnemonic (const char *s)
char* wxFindAccelerator( const char *s ) char* wxFindAccelerator( const char *s )
{ {
#if 1 #if 1
wxUnusedVar(s);
// VZ: this function returns incorrect keysym which completely breaks kbd // VZ: this function returns incorrect keysym which completely breaks kbd
// handling // handling
return NULL; return NULL;
@@ -878,6 +879,7 @@ char* wxFindAccelerator( const char *s )
XmString wxFindAcceleratorText (const char *s) XmString wxFindAcceleratorText (const char *s)
{ {
#if 1 #if 1
wxUnusedVar(s);
// VZ: this function returns incorrect keysym which completely breaks kbd // VZ: this function returns incorrect keysym which completely breaks kbd
// handling // handling
return NULL; return NULL;
@@ -934,6 +936,9 @@ extern void wxDoChangeFont(WXWidget widget, const wxFont& font)
XtVaSetValues( w, XtVaSetValues( w,
wxFont::GetFontTag(), font.GetFontTypeC( XtDisplay(w) ), wxFont::GetFontTag(), font.GetFontTypeC( XtDisplay(w) ),
NULL ); NULL );
#else
wxUnusedVar(widget);
wxUnusedVar(font);
#endif #endif
} }

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: windows.cpp // Name: src/motif/windows.cpp
// Purpose: wxWindow // Purpose: wxWindow
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -200,7 +200,7 @@ void wxWindow::Init()
m_winCaptured = false; m_winCaptured = false;
m_isShown = true; m_isShown = true;
m_hScrollBar = m_hScrollBar =
m_vScrollBar = m_vScrollBar =
m_borderWidget = m_borderWidget =
@@ -352,7 +352,7 @@ wxWindow::~wxWindow()
{ {
if (g_captureWindow == this) if (g_captureWindow == this)
g_captureWindow = NULL; g_captureWindow = NULL;
m_isBeingDeleted = true; m_isBeingDeleted = true;
// Motif-specific actions first // Motif-specific actions first
@@ -747,12 +747,12 @@ int wxWindow::GetScrollPos(int orient) const
int wxWindow::GetScrollRange(int orient) const int wxWindow::GetScrollRange(int orient) const
{ {
Widget scrollBar = (Widget)GetScrollbar((wxOrientation)orient); Widget scrollBar = (Widget)GetScrollbar((wxOrientation)orient);
// CE scintilla windows don't always have these scrollbars // CE scintilla windows don't always have these scrollbars
// and it tends to pile up a whole bunch of asserts // and it tends to pile up a whole bunch of asserts
//wxCHECK_MSG( scrollBar, 0, "no such scrollbar" ); //wxCHECK_MSG( scrollBar, 0, "no such scrollbar" );
int range = 0; int range = 0;
if (scrollBar) if (scrollBar)
XtVaGetValues(scrollBar, XmNmaximum, &range, NULL); XtVaGetValues(scrollBar, XmNmaximum, &range, NULL);
return range; return range;
} }
@@ -1175,7 +1175,7 @@ void wxWindow::DoGetSize(int *x, int *y) const
XmNwidth, &xx, XmNwidth, &xx,
XmNheight, &yy, XmNheight, &yy,
NULL ); NULL );
if(x) *x = xx; if(x) *x = xx;
if(y) *y = yy; if(y) *y = yy;
} }
@@ -1183,7 +1183,7 @@ void wxWindow::DoGetPosition(int *x, int *y) const
{ {
Widget widget = (Widget) Widget widget = (Widget)
( m_drawingArea ? ( m_drawingArea ?
( m_borderWidget ? m_borderWidget : m_scrolledWindow ) : ( m_borderWidget ? m_borderWidget : m_scrolledWindow ) :
GetTopWidget() ); GetTopWidget() );
Position xx, yy; Position xx, yy;
@@ -1194,8 +1194,8 @@ void wxWindow::DoGetPosition(int *x, int *y) const
if (GetParent()) if (GetParent())
{ {
wxPoint pt(GetParent()->GetClientAreaOrigin()); wxPoint pt(GetParent()->GetClientAreaOrigin());
xx -= pt.x; xx = (Position)(xx - pt.x);
yy -= pt.y; yy = (Position)(yy - pt.y);
} }
if(x) *x = xx; if(x) *x = xx;
@@ -1455,7 +1455,7 @@ int wxWindow::GetCharHeight() const
wxCHECK_MSG( m_font.Ok(), 0, "valid window font needed" ); wxCHECK_MSG( m_font.Ok(), 0, "valid window font needed" );
int height; int height;
wxGetTextExtent (GetXDisplay(), m_font, 1.0, wxGetTextExtent (GetXDisplay(), m_font, 1.0,
"x", NULL, &height, NULL, NULL); "x", NULL, &height, NULL, NULL);
@@ -1467,7 +1467,7 @@ int wxWindow::GetCharWidth() const
wxCHECK_MSG( m_font.Ok(), 0, "valid window font needed" ); wxCHECK_MSG( m_font.Ok(), 0, "valid window font needed" );
int width; int width;
wxGetTextExtent (GetXDisplay(), m_font, 1.0, wxGetTextExtent (GetXDisplay(), m_font, 1.0,
"x", &width, NULL, NULL, NULL); "x", &width, NULL, NULL, NULL);
@@ -1894,9 +1894,8 @@ void wxWidgetResizeProc(Widget w, XConfigureEvent *WXUNUSED(event),
if (win->PreResize()) if (win->PreResize())
{ {
int width, height; wxSize newSize(win->GetSize());
win->GetSize(&width, &height); wxSizeEvent sizeEvent(newSize, win->GetId());
wxSizeEvent sizeEvent(wxSize(width, height), win->GetId());
sizeEvent.SetEventObject(win); sizeEvent.SetEventObject(win);
win->GetEventHandler()->ProcessEvent(sizeEvent); win->GetEventHandler()->ProcessEvent(sizeEvent);
} }
@@ -2315,10 +2314,10 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
|| (event_right_is_down (xevent) || (event_right_is_down (xevent)
&& (eventType != wxEVT_RIGHT_UP))); && (eventType != wxEVT_RIGHT_UP)));
wxevent.m_shiftDown = xevent->xbutton.state & ShiftMask; wxevent.m_shiftDown = (xevent->xbutton.state & ShiftMask) == ShiftMask;
wxevent.m_controlDown = xevent->xbutton.state & ControlMask; wxevent.m_controlDown = (xevent->xbutton.state & ControlMask) == ControlMask;
wxevent.m_altDown = xevent->xbutton.state & Mod3Mask; wxevent.m_altDown = (xevent->xbutton.state & Mod3Mask) == Mod3Mask;
wxevent.m_metaDown = xevent->xbutton.state & Mod1Mask; wxevent.m_metaDown = (xevent->xbutton.state & Mod1Mask) == Mod1Mask;
wxevent.SetId(win->GetId()); wxevent.SetId(win->GetId());
wxevent.SetEventObject(win); wxevent.SetEventObject(win);
@@ -2364,9 +2363,8 @@ bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win,
if (id > -1) if (id > -1)
return true; return true;
else
return false; return false;
break;
} }
default: default:
break; break;
@@ -2389,9 +2387,9 @@ int wxComputeColours (Display *display, wxColour * back, wxColour * fore)
if (back) if (back)
{ {
g_itemColors[0].red = (((long) back->Red ()) << 8); g_itemColors[0].red = (unsigned short)(((long) back->Red ()) << 8);
g_itemColors[0].green = (((long) back->Green ()) << 8); g_itemColors[0].green = (unsigned short)(((long) back->Green ()) << 8);
g_itemColors[0].blue = (((long) back->Blue ()) << 8); g_itemColors[0].blue = (unsigned short)(((long) back->Blue ()) << 8);
g_itemColors[0].flags = DoRed | DoGreen | DoBlue; g_itemColors[0].flags = DoRed | DoGreen | DoBlue;
if (colorProc == (XmColorProc) NULL) if (colorProc == (XmColorProc) NULL)
{ {
@@ -2409,9 +2407,9 @@ int wxComputeColours (Display *display, wxColour * back, wxColour * fore)
} }
if (fore) if (fore)
{ {
g_itemColors[wxFORE_INDEX].red = (((long) fore->Red ()) << 8); g_itemColors[wxFORE_INDEX].red = (unsigned short)(((long) fore->Red ()) << 8);
g_itemColors[wxFORE_INDEX].green = (((long) fore->Green ()) << 8); g_itemColors[wxFORE_INDEX].green = (unsigned short)(((long) fore->Green ()) << 8);
g_itemColors[wxFORE_INDEX].blue = (((long) fore->Blue ()) << 8); g_itemColors[wxFORE_INDEX].blue = (unsigned short)(((long) fore->Blue ()) << 8);
g_itemColors[wxFORE_INDEX].flags = DoRed | DoGreen | DoBlue; g_itemColors[wxFORE_INDEX].flags = DoRed | DoGreen | DoBlue;
if (result == wxNO_COLORS) if (result == wxNO_COLORS)
result = wxFORE_COLORS; result = wxFORE_COLORS;