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
- 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
#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
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public:
wxPaintDC() {}
- wxPaintDC(wxWindow* win): wxWindowDC(win) {}
+ wxPaintDC(wxWindow* win);
+ ~wxPaintDC();
};
class WXDLLEXPORT wxClientDC: public wxWindowDC
// 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)?
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 {
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;
/// 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
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)
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;
// ressources
// ----------------------------------------------------------------------------
// the application icon
-#ifdef __WXGTK__
+#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "mondrian.xpm"
#endif
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));
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);
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__
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
okButton->SetDefault();
- SetClientSize(400, by + 30);
+ SetClientSize(450, by + 40);
Centre(wxBOTH);
generic/colrdlgg.cpp \
generic/fontdlgg.cpp \
generic/gridg.cpp \
+ generic/helpext.cpp \
generic/imaglist.cpp \
generic/listctrl.cpp \
generic/laywin.cpp \
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);
// 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)
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();
+}
+
// 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;
- }
-
- 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 ((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;
- */
+
+ wxRect* rect = new wxRect(event->xexpose.x, event->xexpose.y,
+ event->xexpose.width, event->xexpose.height);
+ win->m_updateRects.Append((wxObject*) rect);
+
+ if (event -> xexpose.count == 0)
+ {
+ wxPaintEvent event(win->GetId());
+ event.SetEventObject(win);
+ win->GetEventHandler()->ProcessEvent(event);
+
+ win->ClearUpdateRects();
+ }
break;
- default :
+ }
+ default :
+ {
cout << "\n\nNew Event ! is = " << event -> type << "\n";
break;
- }
- }
+ }
+ }
+}
static void wxDialogBoxEventHandler (Widget wid,
XtPointer WXUNUSED(client_data),
../generic/colrdlgg.cpp \
../generic/fontdlgg.cpp \
../generic/gridg.cpp \
+ ../generic/helpext.cpp \
../generic/imaglist.cpp \
../generic/listctrl.cpp \
../generic/laywin.cpp \
// 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
//-----------------------------------------------------------------------------
// Is region empty?
bool wxRegion::Empty() const
{
- return m_refData ? XEmptyRegion(M_REGION) : FALSE;
+ return m_refData ? XEmptyRegion(M_REGION) : TRUE;
}
//-----------------------------------------------------------------------------
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;
}
}
return (wxBusyCursorCount > 0);
}
+const char* wxGetHomeDir( wxString *home )
+{
+ *home = wxGetUserHome( wxString() );
+ if (home->IsNull()) *home = "/";
+ return *home;
+};
+
char *wxGetUserHome (const wxString& user)
{
#ifdef VMS
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
-#pragma implementation
+// #pragma implementation
#endif
#include "wx/utils.h"
// end VMS
}
-long wxExecute (const wxString& command, bool sync)
+long wxExecute (const wxString& command, bool sync, wxProcess* WXUNUSED(process))
{
#ifdef VMS
return(0);
m_canAddEventHandler = FALSE;
m_scrollPosX = 0;
m_scrollPosY = 0;
- m_paintRegion = (WXRegion) 0;
}
// Destructor
{
//// Motif-specific
- if (m_paintRegion)
- XDestroyRegion ((Region) m_paintRegion);
- m_paintRegion = (WXRegion) 0;
-
if (GetMainWidget())
DetachWidget(GetMainWidget()); // Removes event handlers
if ( m_windowValidator ) delete m_windowValidator;
if (m_clientObject) delete m_clientObject;
+
+ ClearUpdateRects();
}
// Destroy the window (delayed, if a managed window)
m_pixmapOffsetY = 0;
m_scrollPosX = 0;
m_scrollPosY = 0;
- m_paintRegion = (WXRegion) 0;
if (!parent)
return FALSE;
}
// 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
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();
-
- }
- */
-
- 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);
- */
-
- canvas->DoPaint() ; // xrects, n);
- delete[] xrects;
+ 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";
+ */
- canvas->m_updateRects.Clear();
+ win->m_updateRects.Append((wxObject*) rect);
- /*
- if (canvasDC)
- {
- XDestroyRegion(canvasDC->onpaint_reg);
- canvasDC->onpaint_reg = NULL;
- }
-
- XGCValues gc_val;
- gc_val.clip_mask = None;
- XChangeGC(display, gc, GCClipMask, &gc_val);
- */
+ if (event -> xexpose.count == 0)
+ {
+ wxPaintEvent event(win->GetId());
+ event.SetEventObject(win);
+ win->GetEventHandler()->ProcessEvent(event);
- break;
- }
- default:
- {
- cout << "\n\nNew Event ! is = " << event -> type << "\n";
- break;
+ win->ClearUpdateRects();
+ }
+ 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)
ChangeFont();
}
-
+void wxWindow::ClearUpdateRects()
+{
+ wxNode* node = m_updateRects.First();
+ while (node)
+ {
+ wxRect* rect = (wxRect*) node->Data();
+ delete rect;
+ node = node->Next();
+ }
+ m_updateRects.Clear();
+}