Motif bug fixes; dialog OnPaint works now; wxColourDialog tweaking
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -302,6 +302,22 @@ samples/wxsocket/*.xpm
|
||||
samples/wxsocket/*.ico
|
||||
samples/wxsocket/*.rc
|
||||
|
||||
samples/help/*.cpp
|
||||
samples/help/*.h
|
||||
samples/help/*.def
|
||||
samples/help/makefile*
|
||||
samples/help/*.xbm
|
||||
samples/help/*.xpm
|
||||
samples/help/*.ico
|
||||
samples/help/*.rc
|
||||
samples/help/doc/*.html
|
||||
samples/help/doc/*.htm
|
||||
samples/help/doc/*.class
|
||||
samples/help/doc/*.db
|
||||
samples/help/doc/*.tex
|
||||
samples/help/doc/*.gif
|
||||
samples/help/doc/*.map
|
||||
|
||||
samples/bombs/*.cpp
|
||||
samples/bombs/*.h
|
||||
samples/bombs/*.def
|
||||
|
@@ -23,6 +23,9 @@ High Priority
|
||||
|
||||
- Make wxDialog OnPaint work.
|
||||
|
||||
- Optimize wxWindow OnPaint, clipping the damaged
|
||||
region.
|
||||
|
||||
- Implementation of OnEraseBackground. How? Call OnEraseBackground
|
||||
just before OnPaint? Will duplicate Xlib's own erase of the background.
|
||||
However, this is usually OK, because the default wxWindow::OnEraseBackground
|
||||
|
@@ -3,21 +3,16 @@
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include "wx/msw/helpwin.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/helpext.h"
|
||||
#else
|
||||
#include "wx/generic/helpxlp.h"
|
||||
#include "wx/generic/helpext.h"
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#define wxHelpController wxWinHelpController
|
||||
#define sm_classwxHelpController sm_classwxWinHelpController
|
||||
#elif defined(__WXGTK__)
|
||||
#else
|
||||
#define wxHelpController wxExtHelpController
|
||||
#define sm_classwxHelpController sm_classwxExtHelpController
|
||||
#else
|
||||
#define wxHelpController wxXLPHelpController
|
||||
#define sm_classwxHelpController sm_classwxXLPHelpController
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -131,7 +131,8 @@ class WXDLLEXPORT wxPaintDC: public wxWindowDC
|
||||
DECLARE_DYNAMIC_CLASS(wxPaintDC)
|
||||
public:
|
||||
wxPaintDC() {}
|
||||
wxPaintDC(wxWindow* win): wxWindowDC(win) {}
|
||||
wxPaintDC(wxWindow* win);
|
||||
~wxPaintDC();
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxClientDC: public wxWindowDC
|
||||
|
@@ -84,7 +84,8 @@ public:
|
||||
|
||||
// Is region empty?
|
||||
bool Empty() const;
|
||||
inline bool IsEmpty() const { return Empty(); }
|
||||
inline bool IsEmpty() const { return Empty(); }
|
||||
bool Ok() const { return (m_refData != NULL) ; }
|
||||
|
||||
//# Tests
|
||||
// Does the region contain the point (x,y)?
|
||||
@@ -100,6 +101,9 @@ public:
|
||||
bool Combine(long x, long y, long width, long height, wxRegionOp op);
|
||||
bool Combine(const wxRegion& region, wxRegionOp op);
|
||||
bool Combine(const wxRect& rect, wxRegionOp op);
|
||||
|
||||
// Get the internal Region handle
|
||||
WXRegion GetXRegion() ;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxRegionIterator : public wxObject {
|
||||
|
@@ -231,7 +231,7 @@ public:
|
||||
virtual void DragAcceptFiles(bool accept);
|
||||
|
||||
// Update region access
|
||||
virtual wxRegion GetUpdateRegion() const;
|
||||
virtual wxRegion& GetUpdateRegion() const;
|
||||
virtual bool IsExposed(int x, int y, int w, int h) const;
|
||||
virtual bool IsExposed(const wxPoint& pt) const;
|
||||
virtual bool IsExposed(const wxRect& rect) const;
|
||||
@@ -486,6 +486,7 @@ public:
|
||||
|
||||
/// Motif-specific
|
||||
|
||||
void ClearUpdateRects();
|
||||
void CanvasGetSize(int* width, int* height) const; // If have drawing area
|
||||
void CanvasGetClientSize(int *width, int *height) const;
|
||||
void CanvasGetPosition(int *x, int *y) const; // If have drawing area
|
||||
@@ -518,7 +519,6 @@ public:
|
||||
virtual WXPixmap GetBackingPixmap() const { return m_backingPixmap; }
|
||||
inline int GetPixmapWidth() const { return m_pixmapWidth; }
|
||||
inline int GetPixmapHeight() const { return m_pixmapHeight; }
|
||||
virtual WXRegion GetPaintRegion() const { return m_paintRegion; }
|
||||
|
||||
// Change properties
|
||||
virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
|
||||
@@ -594,7 +594,6 @@ public:
|
||||
int m_lastButton; // last pressed button
|
||||
wxList m_updateRects; // List of wxRectangles representing damaged region
|
||||
bool m_isShown;
|
||||
WXRegion m_paintRegion; // Clip region generated by expose event
|
||||
protected:
|
||||
WXWidget m_mainWidget;
|
||||
WXWidget m_hScrollBar;
|
||||
|
@@ -41,7 +41,7 @@
|
||||
// ressources
|
||||
// ----------------------------------------------------------------------------
|
||||
// the application icon
|
||||
#ifdef __WXGTK__
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
#include "mondrian.xpm"
|
||||
#endif
|
||||
|
||||
|
@@ -232,7 +232,7 @@ void wxGenericColourDialog::CreateWidgets(void)
|
||||
int bw, bh;
|
||||
okButton->GetSize(&bw, &bh);
|
||||
|
||||
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(okButtonX + bw + 10, buttonY));
|
||||
(void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(okButtonX + bw + 20, buttonY));
|
||||
(void) new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours"),
|
||||
wxPoint(customButtonX, buttonY));
|
||||
|
||||
@@ -252,7 +252,7 @@ void wxGenericColourDialog::CreateWidgets(void)
|
||||
blueSlider = new wxSlider(this, wxID_BLUE_SLIDER, 0, 0, 255,
|
||||
wxPoint(sliderX + 2*sliderSpacing, 10), wxSize(-1, sliderHeight), wxVERTICAL|wxSL_LABELS);
|
||||
|
||||
SetClientSize(sliderX + 3*sliderSpacing, buttonY + 30);
|
||||
SetClientSize(sliderX + 3*sliderSpacing, buttonY + 40);
|
||||
okButton->SetDefault();
|
||||
|
||||
Centre(wxBOTH);
|
||||
|
@@ -209,8 +209,8 @@ void wxGenericFontDialog::CreateWidgets(void)
|
||||
int x=-1;
|
||||
int y=40;
|
||||
familyChoice = new wxChoice(this, wxID_FONT_FAMILY, wxPoint(10, 10), wxSize(120, -1), 5, families);
|
||||
styleChoice = new wxChoice(this, wxID_FONT_STYLE, wxPoint(140, 10), wxSize(120, -1), 3, styles);
|
||||
weightChoice = new wxChoice(this, wxID_FONT_WEIGHT, wxPoint(270, 10), wxSize(120, -1), 3, weights);
|
||||
styleChoice = new wxChoice(this, wxID_FONT_STYLE, wxPoint(160, 10), wxSize(120, -1), 3, styles);
|
||||
weightChoice = new wxChoice(this, wxID_FONT_WEIGHT, wxPoint(310, 10), wxSize(120, -1), 3, weights);
|
||||
|
||||
colourChoice = new wxChoice(this, wxID_FONT_COLOUR, wxPoint(10, 40), wxSize(190, -1), NUM_COLS, wxColourDialogNames);
|
||||
#ifdef __MOTIF__
|
||||
@@ -228,8 +228,8 @@ void wxGenericFontDialog::CreateWidgets(void)
|
||||
pointSizes[i] = buf;
|
||||
}
|
||||
|
||||
pointSizeChoice = new wxChoice(this, wxID_FONT_SIZE, wxPoint(210, y), wxSize(50, -1), 40, pointSizes);
|
||||
underLineCheckBox = new wxCheckBox(this, wxID_FONT_UNDERLINE, _("Underline"), wxPoint(280, y));
|
||||
pointSizeChoice = new wxChoice(this, wxID_FONT_SIZE, wxPoint(230, y), wxSize(50, -1), 40, pointSizes);
|
||||
underLineCheckBox = new wxCheckBox(this, wxID_FONT_UNDERLINE, _("Underline"), wxPoint(320, y));
|
||||
|
||||
int rectY;
|
||||
pointSizeChoice->GetPosition(&x, &rectY); //NL mod
|
||||
@@ -257,7 +257,7 @@ void wxGenericFontDialog::CreateWidgets(void)
|
||||
|
||||
okButton->SetDefault();
|
||||
|
||||
SetClientSize(400, by + 30);
|
||||
SetClientSize(450, by + 40);
|
||||
|
||||
Centre(wxBOTH);
|
||||
|
||||
|
@@ -123,6 +123,7 @@ LIB_CPP_SRC=\
|
||||
generic/colrdlgg.cpp \
|
||||
generic/fontdlgg.cpp \
|
||||
generic/gridg.cpp \
|
||||
generic/helpext.cpp \
|
||||
generic/imaglist.cpp \
|
||||
generic/listctrl.cpp \
|
||||
generic/laywin.cpp \
|
||||
|
@@ -416,7 +416,8 @@ void wxChoiceCallback (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr))
|
||||
XtVaGetValues (w, XmNuserData, &s, NULL);
|
||||
if (s)
|
||||
{
|
||||
wxCommandEvent event (wxEVT_COMMAND_CHOICE_SELECTED);
|
||||
wxCommandEvent event (wxEVT_COMMAND_CHOICE_SELECTED, item->GetId());
|
||||
event.SetEventObject(item);
|
||||
event.m_commandInt = item->FindString (s);
|
||||
// event.m_commandString = s;
|
||||
item->ProcessCommand (event);
|
||||
|
@@ -1992,17 +1992,17 @@ void wxWindowDC:: SetDCClipping ()
|
||||
// clipping imposed on a window by a repaint.
|
||||
// We'll combine it with the user region. But for now,
|
||||
// just use the currently-defined user clipping region.
|
||||
if (m_userRegion || (m_window && m_window->GetPaintRegion()) )
|
||||
if (m_userRegion || (m_window && m_window->GetUpdateRegion().Ok()) )
|
||||
m_currentRegion = (WXRegion) XCreateRegion ();
|
||||
else
|
||||
m_currentRegion = (WXRegion) NULL;
|
||||
|
||||
if ((m_window && m_window->GetPaintRegion()) && m_userRegion)
|
||||
XIntersectRegion ((Region) m_window->GetPaintRegion(), (Region) m_userRegion, (Region) m_currentRegion);
|
||||
if ((m_window && m_window->GetUpdateRegion().Ok()) && m_userRegion)
|
||||
XIntersectRegion ((Region) m_window->GetUpdateRegion().GetXRegion(), (Region) m_userRegion, (Region) m_currentRegion);
|
||||
else if (m_userRegion)
|
||||
XIntersectRegion ((Region) m_userRegion, (Region) m_userRegion, (Region) m_currentRegion);
|
||||
else if (m_window && m_window->GetPaintRegion())
|
||||
XIntersectRegion ((Region) m_window->GetPaintRegion(), (Region) m_window->GetPaintRegion(),
|
||||
else if (m_window && m_window->GetUpdateRegion().Ok())
|
||||
XIntersectRegion ((Region) m_window->GetUpdateRegion().GetXRegion(), (Region) m_window->GetUpdateRegion().GetXRegion(),
|
||||
(Region) m_currentRegion);
|
||||
|
||||
if (m_currentRegion)
|
||||
@@ -2225,3 +2225,56 @@ void wxWindowDC::DrawSpline( wxList *points )
|
||||
|
||||
wx_spline_draw_point_array( this );
|
||||
};
|
||||
|
||||
/*
|
||||
* wxPaintDC
|
||||
*/
|
||||
|
||||
wxPaintDC::wxPaintDC(wxWindow* win): wxWindowDC(win)
|
||||
{
|
||||
wxRegion* region = NULL;
|
||||
|
||||
// Combine all the update rects into a region
|
||||
if (win->m_updateRects.Number() > 0)
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < win->m_updateRects.Number(); i++)
|
||||
{
|
||||
wxRect* rect = (wxRect*) win->m_updateRects.Nth(i)->Data();
|
||||
/*
|
||||
cout << "wxPaintDC. wxRect: " << rect->x << ", " << rect->y << ", ";
|
||||
cout << rect->width << ", " << rect->height << "\n\n";
|
||||
*/
|
||||
|
||||
if (!region)
|
||||
region = new wxRegion(*rect);
|
||||
else
|
||||
// TODO: is this correct? In SetDCClipping above,
|
||||
// XIntersectRegion is used to combine paint and user
|
||||
// regions. XIntersectRegion appears to work in that case...
|
||||
region->Union(*rect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int cw, ch;
|
||||
win->GetClientSize(&cw, &ch);
|
||||
region = new wxRegion(wxRect(0, 0, cw, ch));
|
||||
}
|
||||
|
||||
win->m_updateRegion = *region;
|
||||
|
||||
// Set the clipping region. Any user-defined region will be combined with this
|
||||
// one in SetDCClipping.
|
||||
XSetRegion ((Display*) m_display, (GC) m_gc, (Region) region->GetXRegion());
|
||||
|
||||
delete region;
|
||||
}
|
||||
|
||||
wxPaintDC::~wxPaintDC()
|
||||
{
|
||||
XSetClipMask ((Display*) m_display, (GC) m_gc, None);
|
||||
if (m_window)
|
||||
m_window->m_updateRegion.Clear();
|
||||
}
|
||||
|
||||
|
@@ -617,86 +617,42 @@ static void wxCloseDialogCallback( Widget WXUNUSED(widget), XtPointer client_dat
|
||||
// TODO: Preferably, we should have a universal repaint proc.
|
||||
// Meanwhile, use a special one for dialogs.
|
||||
static void wxDialogBoxRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *)
|
||||
{
|
||||
{
|
||||
Window window;
|
||||
Display *display;
|
||||
/*
|
||||
static XRectangle *xrect;
|
||||
GC gc;
|
||||
int llp = 0;
|
||||
static int last_count = 0;
|
||||
static int draw_count = 0;
|
||||
*/
|
||||
|
||||
wxWindow* win = (wxWindow *)wxWidgetHashTable->Get((long)w);
|
||||
if (!win)
|
||||
return;
|
||||
|
||||
switch(event -> type)
|
||||
{
|
||||
{
|
||||
case Expose :
|
||||
{
|
||||
window = (Window) win -> GetXWindow();
|
||||
display = (Display *) win -> GetXDisplay();
|
||||
/* TODO
|
||||
gc = (GC) panel -> GetDC() -> gc;
|
||||
|
||||
llp = event -> xexpose.count;
|
||||
|
||||
if ((last_count == 0) && (llp == 0))
|
||||
{
|
||||
xrect = new XRectangle[1];
|
||||
xrect[0].x = event -> xexpose.x;
|
||||
xrect[0].y = event -> xexpose.y;
|
||||
xrect[0].width = event -> xexpose.width;
|
||||
xrect[0].height = event -> xexpose.height;
|
||||
|
||||
XSetClipRectangles(display,gc,0,0,xrect,1,Unsorted);
|
||||
// panel->DoPaint(xrect, 1);
|
||||
panel->GetEventHandler()->OnPaint();
|
||||
|
||||
delete xrect;
|
||||
}
|
||||
wxRect* rect = new wxRect(event->xexpose.x, event->xexpose.y,
|
||||
event->xexpose.width, event->xexpose.height);
|
||||
win->m_updateRects.Append((wxObject*) rect);
|
||||
|
||||
if ((last_count == 0) && (llp != 0))
|
||||
{
|
||||
xrect = new XRectangle[llp + 1];
|
||||
draw_count = llp + 1;
|
||||
|
||||
xrect[draw_count - llp - 1].x = event -> xexpose.x;
|
||||
xrect[draw_count - llp - 1].y = event -> xexpose.y;
|
||||
xrect[draw_count - llp - 1].width = event -> xexpose.width;
|
||||
xrect[draw_count - llp - 1].height = event -> xexpose.height;
|
||||
}
|
||||
if (event -> xexpose.count == 0)
|
||||
{
|
||||
wxPaintEvent event(win->GetId());
|
||||
event.SetEventObject(win);
|
||||
win->GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
if ((last_count != 0) && (llp != 0))
|
||||
{
|
||||
xrect[draw_count - llp - 1].x = event -> xexpose.x;
|
||||
xrect[draw_count - llp - 1].y = event -> xexpose.y;
|
||||
xrect[draw_count - llp - 1].width = event -> xexpose.width;
|
||||
xrect[draw_count - llp - 1].height = event -> xexpose.height;
|
||||
}
|
||||
|
||||
if ((last_count != 0) && (llp == 0))
|
||||
{
|
||||
xrect[draw_count - llp - 1].x = event -> xexpose.x;
|
||||
xrect[draw_count - llp - 1].y = event -> xexpose.y;
|
||||
xrect[draw_count - llp - 1].width = event -> xexpose.width;
|
||||
xrect[draw_count - llp - 1].height = event -> xexpose.height;
|
||||
|
||||
XSetClipRectangles(display,gc,0,0,xrect,draw_count,Unsorted);
|
||||
// panel->DoPaint(xrect,draw_count);
|
||||
panel->GetEventHandler()->OnPaint();
|
||||
|
||||
delete xrect;
|
||||
}
|
||||
last_count = event -> xexpose.count;
|
||||
*/
|
||||
win->ClearUpdateRects();
|
||||
}
|
||||
break;
|
||||
default :
|
||||
}
|
||||
default :
|
||||
{
|
||||
cout << "\n\nNew Event ! is = " << event -> type << "\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void wxDialogBoxEventHandler (Widget wid,
|
||||
XtPointer WXUNUSED(client_data),
|
||||
|
@@ -137,6 +137,7 @@ LIB_CPP_SRC=\
|
||||
../generic/colrdlgg.cpp \
|
||||
../generic/fontdlgg.cpp \
|
||||
../generic/gridg.cpp \
|
||||
../generic/helpext.cpp \
|
||||
../generic/imaglist.cpp \
|
||||
../generic/listctrl.cpp \
|
||||
../generic/laywin.cpp \
|
||||
|
@@ -104,6 +104,14 @@ wxRegion::~wxRegion()
|
||||
// m_refData unrefed in ~wxObject
|
||||
}
|
||||
|
||||
// Get the internal region handle
|
||||
WXRegion wxRegion::GetXRegion()
|
||||
{
|
||||
wxASSERT( m_refData !=NULL );
|
||||
|
||||
return (WXRegion) ((wxRegionRefData*)m_refData)->m_region;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Modify region
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -237,7 +245,7 @@ wxRect wxRegion::GetBox() const
|
||||
// Is region empty?
|
||||
bool wxRegion::Empty() const
|
||||
{
|
||||
return m_refData ? XEmptyRegion(M_REGION) : FALSE;
|
||||
return m_refData ? XEmptyRegion(M_REGION) : TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@@ -281,6 +281,11 @@ void wxSliderCallback (Widget widget, XtPointer clientData, XmScaleCallbackStruc
|
||||
XtVaGetValues (widget, XmNvalue, &event.m_commandInt, NULL);
|
||||
event.SetEventObject(slider);
|
||||
slider->ProcessCommand(event);
|
||||
|
||||
// Also send a wxCommandEvent for compatibility.
|
||||
wxCommandEvent event2(wxEVT_COMMAND_SLIDER_UPDATED, slider->GetId());
|
||||
event2.SetEventObject(slider);
|
||||
slider->ProcessCommand(event2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -615,6 +615,13 @@ bool wxIsBusy()
|
||||
return (wxBusyCursorCount > 0);
|
||||
}
|
||||
|
||||
const char* wxGetHomeDir( wxString *home )
|
||||
{
|
||||
*home = wxGetUserHome( wxString() );
|
||||
if (home->IsNull()) *home = "/";
|
||||
return *home;
|
||||
};
|
||||
|
||||
char *wxGetUserHome (const wxString& user)
|
||||
{
|
||||
#ifdef VMS
|
||||
|
@@ -10,7 +10,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
// #pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/utils.h"
|
||||
@@ -135,7 +135,7 @@ long wxExecute(char **argv, bool sync, wxProcess *WXUNUSED(handler))
|
||||
// end VMS
|
||||
}
|
||||
|
||||
long wxExecute (const wxString& command, bool sync)
|
||||
long wxExecute (const wxString& command, bool sync, wxProcess* WXUNUSED(process))
|
||||
{
|
||||
#ifdef VMS
|
||||
return(0);
|
||||
|
@@ -135,7 +135,6 @@ wxWindow::wxWindow()
|
||||
m_canAddEventHandler = FALSE;
|
||||
m_scrollPosX = 0;
|
||||
m_scrollPosY = 0;
|
||||
m_paintRegion = (WXRegion) 0;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@@ -143,10 +142,6 @@ wxWindow::~wxWindow()
|
||||
{
|
||||
//// Motif-specific
|
||||
|
||||
if (m_paintRegion)
|
||||
XDestroyRegion ((Region) m_paintRegion);
|
||||
m_paintRegion = (WXRegion) 0;
|
||||
|
||||
if (GetMainWidget())
|
||||
DetachWidget(GetMainWidget()); // Removes event handlers
|
||||
|
||||
@@ -243,6 +238,8 @@ wxWindow::~wxWindow()
|
||||
|
||||
if ( m_windowValidator ) delete m_windowValidator;
|
||||
if (m_clientObject) delete m_clientObject;
|
||||
|
||||
ClearUpdateRects();
|
||||
}
|
||||
|
||||
// Destroy the window (delayed, if a managed window)
|
||||
@@ -309,7 +306,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
m_pixmapOffsetY = 0;
|
||||
m_scrollPosX = 0;
|
||||
m_scrollPosY = 0;
|
||||
m_paintRegion = (WXRegion) 0;
|
||||
|
||||
if (!parent)
|
||||
return FALSE;
|
||||
@@ -2016,9 +2012,9 @@ bool wxWindow::AcceptsFocus() const
|
||||
}
|
||||
|
||||
// Update region access
|
||||
wxRegion wxWindow::GetUpdateRegion() const
|
||||
wxRegion& wxWindow::GetUpdateRegion() const
|
||||
{
|
||||
return m_updateRegion;
|
||||
return (wxRegion&) m_updateRegion;
|
||||
}
|
||||
|
||||
bool wxWindow::IsExposed(int x, int y, int w, int h) const
|
||||
@@ -2135,75 +2131,41 @@ void wxCanvasRepaintProc (Widget drawingArea, XtPointer clientData,
|
||||
XmDrawingAreaCallbackStruct * cbs)
|
||||
{
|
||||
if (!wxWidgetHashTable->Get ((long) (Widget) drawingArea))
|
||||
return;
|
||||
return;
|
||||
|
||||
XEvent * event = cbs->event;
|
||||
wxWindow * canvas = (wxWindow *) clientData;
|
||||
Display * display = (Display *) canvas->GetXDisplay();
|
||||
// GC gc = (GC) canvas->GetDC()->gc;
|
||||
wxWindow * win = (wxWindow *) clientData;
|
||||
Display * display = (Display *) win->GetXDisplay();
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case Expose:
|
||||
{
|
||||
/* TODO
|
||||
wxCanvasDC* canvasDC = canvas->GetDC();
|
||||
if (canvasDC)
|
||||
{
|
||||
if (canvasDC->onpaint_reg)
|
||||
XDestroyRegion(canvasDC->onpaint_reg);
|
||||
canvasDC->onpaint_reg = XCreateRegion();
|
||||
|
||||
}
|
||||
*/
|
||||
case Expose:
|
||||
{
|
||||
wxRect* rect = new wxRect(event->xexpose.x, event->xexpose.y,
|
||||
event->xexpose.width, event->xexpose.height);
|
||||
/*
|
||||
cout << "Expose proc. wxRect: " << rect->x << ", " << rect->y << ", ";
|
||||
cout << rect->width << ", " << rect->height << "\n\n";
|
||||
*/
|
||||
|
||||
int n = canvas->m_updateRects.Number();
|
||||
XRectangle* xrects = new XRectangle[n];
|
||||
int i;
|
||||
for (i = 0; i < canvas->m_updateRects.Number(); i++)
|
||||
{
|
||||
wxRect* rect = (wxRect*) canvas->m_updateRects.Nth(i)->Data();
|
||||
xrects[i].x = rect->x;
|
||||
xrects[i].y = rect->y;
|
||||
xrects[i].width = rect->width;
|
||||
xrects[i].height = rect->height;
|
||||
/* TODO (?) Actually ignore it I think.
|
||||
if (canvasDC)
|
||||
XUnionRectWithRegion(&(xrects[i]), canvasDC->onpaint_reg,
|
||||
canvasDC->onpaint_reg);
|
||||
*/
|
||||
}
|
||||
/* TODO must clip the area being repainted. So we need a gc.
|
||||
* Alternatively, wxPaintDC must do the clipping
|
||||
* when it's created.
|
||||
XSetClipRectangles(display, gc, 0, 0, xrects, n, Unsorted);
|
||||
*/
|
||||
win->m_updateRects.Append((wxObject*) rect);
|
||||
|
||||
canvas->DoPaint() ; // xrects, n);
|
||||
delete[] xrects;
|
||||
if (event -> xexpose.count == 0)
|
||||
{
|
||||
wxPaintEvent event(win->GetId());
|
||||
event.SetEventObject(win);
|
||||
win->GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
canvas->m_updateRects.Clear();
|
||||
|
||||
/*
|
||||
if (canvasDC)
|
||||
{
|
||||
XDestroyRegion(canvasDC->onpaint_reg);
|
||||
canvasDC->onpaint_reg = NULL;
|
||||
}
|
||||
|
||||
XGCValues gc_val;
|
||||
gc_val.clip_mask = None;
|
||||
XChangeGC(display, gc, GCClipMask, &gc_val);
|
||||
*/
|
||||
|
||||
break;
|
||||
win->ClearUpdateRects();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
cout << "\n\nNew Event ! is = " << event -> type << "\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
cout << "\n\nNew Event ! is = " << event -> type << "\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Unable to deal with Enter/Leave without a separate EventHandler (Motif 1.1.4)
|
||||
@@ -3138,4 +3100,14 @@ void wxWindow::SetFont(const wxFont& font)
|
||||
ChangeFont();
|
||||
}
|
||||
|
||||
|
||||
void wxWindow::ClearUpdateRects()
|
||||
{
|
||||
wxNode* node = m_updateRects.First();
|
||||
while (node)
|
||||
{
|
||||
wxRect* rect = (wxRect*) node->Data();
|
||||
delete rect;
|
||||
node = node->Next();
|
||||
}
|
||||
m_updateRects.Clear();
|
||||
}
|
||||
|
Reference in New Issue
Block a user