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
// include this header from here for many of the GUI related code
#if wxUSE_GUI
extern "C" { extern "C" {
#endif
#include <Xm/VendorSP.h> #include <Xm/VendorSP.h>
#ifdef __cplusplus
} }
#endif #endif
// 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
#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,8 +113,7 @@ 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);
@@ -126,19 +125,20 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
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) #if !wxUSE_INVISIBLE_RESIZE
{
XtManageChild(dialogShell); XtManageChild(dialogShell);
SetSize(pos.x, pos.y, size.x, size.y); SetSize(pos.x, pos.y, size.x, size.y);
} #endif
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)

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,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: gauge.cpp // Name: src/motif/gauge.cpp
// Purpose: wxGauge class // Purpose: wxGauge class
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -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
@@ -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
} }

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: gdiobj.cpp // Name: src/motif/gdiobj.cpp
// Purpose: wxGDIObject class // Purpose: wxGDIObject class
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -9,6 +9,10 @@
// 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,16 +18,16 @@
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;
@@ -34,7 +35,9 @@ static void _GSocket_Motif_Output(XtPointer data, int *fid,
} }
bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop()
{ return true; } {
return true;
}
bool GSocketGUIFunctionsTableConcrete::OnInit(void) bool GSocketGUIFunctionsTableConcrete::OnInit(void)
{ {

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: icon.cpp // Name: src/motif/icon.cpp
// Purpose: wxIcon class // Purpose: wxIcon class
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:

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:
@@ -338,11 +338,13 @@ 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);
if (item) return item;
}
return NULL; return NULL;
} }
@@ -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,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// 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:
@@ -9,6 +9,9 @@
// 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,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: radiobut.cpp // Name: src/motif/radiobut.cpp
// Purpose: wxRadioButton // Purpose: wxRadioButton
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
@@ -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:
@@ -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

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:
@@ -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
@@ -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();
@@ -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,
@@ -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:
@@ -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;
@@ -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;