#include "wx/menuitem.h"
#include "wx/log.h"
-#include "wx/listimpl.cpp"
-
#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
#endif
// implementation
// ============================================================================
-// ----------------------------------------------------------------------------
-// list types
-// ----------------------------------------------------------------------------
-
-WX_DEFINE_LIST(wxRectList);
-
// ----------------------------------------------------------------------------
// helper functions
// ----------------------------------------------------------------------------
XtAppAddActions ((XtAppContext) wxTheApp->GetAppContext(), actions, 1);
Widget parentWidget = (Widget) parent->GetClientWidget();
- if (style & wxBORDER)
+
+ if (style & wxSIMPLE_BORDER)
+ {
+ m_borderWidget = (WXWidget)XtVaCreateManagedWidget
+ (
+ "canvasBorder",
+ xmFrameWidgetClass, parentWidget,
+ XmNshadowType, XmSHADOW_IN,
+ XmNshadowThickness, 1,
+ NULL
+ );
+ } else if (style & wxSUNKEN_BORDER)
{
m_borderWidget = (WXWidget)XtVaCreateManagedWidget
(
XmNshadowType, XmSHADOW_IN,
NULL
);
+ } else if (style & wxRAISED_BORDER)
+ {
+ m_borderWidget = (WXWidget)XtVaCreateManagedWidget
+ (
+ "canvasBorder",
+ xmFrameWidgetClass, parentWidget,
+ XmNshadowType, XmSHADOW_OUT,
+ NULL
+ );
}
m_scrolledWindow = (WXWidget)XtVaCreateManagedWidget
}
wxASSERT_MSG( m_cursor.Ok(),
- _T("cursor must be valid after call to the base version"));
+ wxT("cursor must be valid after call to the base version"));
WXDisplay *dpy = GetXDisplay();
WXCursor x_cursor = m_cursor.GetXCursor(dpy);
GetClientSize(& w, & h);
}
+ wxNode *cnode = m_children.First();
+ while (cnode)
+ {
+ wxWindow *child = (wxWindow*) cnode->Data();
+ int sx = 0;
+ int sy = 0;
+ child->GetSize( &sx, &sy );
+ wxPoint pos( child->GetPosition() );
+ child->SetSize( pos.x + dx, pos.y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE );
+ cnode = cnode->Next();
+ }
+
int x1 = (dx >= 0) ? x : x - dx;
int y1 = (dy >= 0) ? y : y - dy;
int w1 = w - abs(dx);
}
}
-void wxWindow::OnIdle(wxIdleEvent& event)
+void wxWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
{
// This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information)
// Try for a menu command
if (frame->GetMenuBar())
{
- wxMenuItem* item = frame->GetMenuBar()->FindItemForId(entry->GetCommand());
+ wxMenuItem* item = frame->GetMenuBar()->FindItem(entry->GetCommand());
if (item)
{
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, entry->GetCommand());
// ----------------------------------------------------------------------------
// Add to hash table, add event handler
-bool wxWindow::AttachWidget (wxWindow* parent, WXWidget mainWidget,
+bool wxWindow::AttachWidget (wxWindow* WXUNUSED(parent), WXWidget mainWidget,
WXWidget formWidget, int x, int y, int width, int height)
{
wxAddWindowToTable((Widget) mainWidget, this);
// All widgets should have this as their resize proc.
// OnSize sent to wxWindow via client data.
-void wxWidgetResizeProc(Widget w, XConfigureEvent *event, String args[], int *num_args)
+void wxWidgetResizeProc(Widget w, XConfigureEvent *WXUNUSED(event), String WXUNUSED(args)[], int *WXUNUSED(num_args))
{
wxWindow *win = wxGetWindowFromTable(w);
if (!win)
// Unable to deal with Enter/Leave without a separate EventHandler (Motif 1.1.4)
static void wxCanvasEnterLeave(Widget drawingArea,
- XtPointer clientData,
+ XtPointer WXUNUSED(clientData),
XCrossingEvent * event)
{
XmDrawingAreaCallbackStruct cbs;
}
// Fix to make it work under Motif 1.0 (!)
-static void wxCanvasMotionEvent (Widget drawingArea, XButtonEvent * event)
+static void wxCanvasMotionEvent (Widget WXUNUSED(drawingArea), XButtonEvent * WXUNUSED(event))
{
#if XmVersion <= 1000
XmDrawingAreaCallbackStruct cbs;
}
static void wxCanvasInputEvent(Widget drawingArea,
- XtPointer data,
+ XtPointer WXUNUSED(data),
XmDrawingAreaCallbackStruct * cbs)
{
wxWindow *canvas = wxGetWindowFromTable(drawingArea);
case ButtonRelease:
case MotionNotify:
{
+ // FIXME: most of this mouse event code is more or less
+ // duplicated in wxTranslateMouseEvent
+ //
wxEventType eventType = wxEVT_NULL;
if (local_event.xany.type == EnterNotify)
}
else if (local_event.xany.type == LeaveNotify)
{
- //if (local_event.xcrossing.mode!=NotifyNormal)
+ //if (local_event.xcrossingr.mode!=NotifyNormal)
// return ; // Ignore grab events
eventType = wxEVT_LEAVE_WINDOW;
// canvas->GetEventHandler()->OnKillFocus();
}
static void wxPanelItemEventHandler(Widget wid,
- XtPointer client_data,
+ XtPointer WXUNUSED(client_data),
XEvent* event,
Boolean *continueToDispatch)
{
{
switch (xevent->xany.type)
{
- case EnterNotify:
- case LeaveNotify:
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
+ case EnterNotify: // never received here - yes ? MB
+ case LeaveNotify: // never received here - yes ? MB
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
{
wxEventType eventType = wxEVT_NULL;
+ // FIXME: this is never true I think - MB
+ //
if (xevent->xany.type == LeaveNotify)
{
win->SetButton1(FALSE);
}
else if (xevent->xany.type == ButtonPress)
{
+ wxevent.SetTimestamp(xevent->xbutton.time);
+ int button = 0;
if (xevent->xbutton.button == Button1)
{
eventType = wxEVT_LEFT_DOWN;
win->SetButton1(TRUE);
+ button = 1;
}
else if (xevent->xbutton.button == Button2)
{
eventType = wxEVT_MIDDLE_DOWN;
win->SetButton2(TRUE);
+ button = 2;
}
else if (xevent->xbutton.button == Button3)
{
eventType = wxEVT_RIGHT_DOWN;
win->SetButton3(TRUE);
+ button = 3;
+ }
+
+ // check for a double click
+ //
+ long dclickTime = XtGetMultiClickTime((Display*) wxGetDisplay());
+ long ts = wxevent.GetTimestamp();
+
+ int buttonLast = win->GetLastClickedButton();
+ long lastTS = win->GetLastClickTime();
+ if ( buttonLast && buttonLast == button && (ts - lastTS) < dclickTime )
+ {
+ // I have a dclick
+ win->SetLastClick(0, ts);
+ switch ( eventType )
+ {
+ case wxEVT_LEFT_DOWN:
+ eventType = wxEVT_LEFT_DCLICK;
+ break;
+ case wxEVT_MIDDLE_DOWN:
+ eventType = wxEVT_MIDDLE_DCLICK;
+ break;
+ case wxEVT_RIGHT_DOWN:
+ eventType = wxEVT_RIGHT_DCLICK;
+ break;
+
+ default :
+ break;
+ }
+
+ }
+ else
+ {
+ // not fast enough or different button
+ win->SetLastClick(button, ts);
}
}
else if (xevent->xany.type == ButtonRelease)
wxevent.m_shiftDown = xevent->xbutton.state & ShiftMask;
wxevent.m_controlDown = xevent->xbutton.state & ControlMask;
+ wxevent.m_altDown = xevent->xbutton.state & Mod3Mask;
+ wxevent.m_metaDown = xevent->xbutton.state & Mod1Mask;
+
+ wxevent.SetId(win->GetId());
+ wxevent.SetEventObject(win);
+
return TRUE;
}
}
return FALSE;
}
-bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget widget, XEvent *xevent)
+bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Widget WXUNUSED(widget), XEvent *xevent)
{
switch (xevent->xany.type)
{