Accelerators implemented for wxMotif; some wxComboBox stupidities cured
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -45,10 +45,10 @@
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
|
||||
EVT_SIZE(wxGenericGrid::OnSize)
|
||||
EVT_PAINT(wxGenericGrid::OnPaint)
|
||||
EVT_ERASE_BACKGROUND(wxGenericGrid::OnEraseBackground)
|
||||
EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
|
||||
EVT_SIZE(wxGenericGrid::OnSize)
|
||||
EVT_PAINT(wxGenericGrid::OnPaint)
|
||||
EVT_ERASE_BACKGROUND(wxGenericGrid::OnEraseBackground)
|
||||
EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
|
||||
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
|
||||
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
|
||||
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
|
||||
@@ -898,15 +898,6 @@ void wxGenericGrid::AdjustScrollbars(void)
|
||||
int cw, ch;
|
||||
GetClientSize(&cw, &ch);
|
||||
|
||||
// To calculate the number of steps for each scrollbar,
|
||||
// we need to see how much will fit onto the canvas
|
||||
// at the present size. So:
|
||||
// 1) Find the *last* row r1 such that when it's at the top of the
|
||||
// window, all the remaining rows are visible.
|
||||
// 2) There should therefore be r1 - 1 steps in the scrollbar.
|
||||
// Similarly with columns.
|
||||
|
||||
// IGNORE THE ABOVE, it's crap.
|
||||
// We find the view size by seeing how many rows/cols fit on
|
||||
// the current view.
|
||||
// BUT... this means that the scrollbar should be adjusted every time
|
||||
@@ -933,10 +924,6 @@ void wxGenericGrid::AdjustScrollbars(void)
|
||||
{
|
||||
noHorizSteps = 0;
|
||||
int widthCount = 0;
|
||||
/*
|
||||
if (GetLabelSize(wxVERTICAL) > 0)
|
||||
noHorizSteps ++;
|
||||
*/
|
||||
|
||||
int i;
|
||||
int nx = 0;
|
||||
@@ -960,10 +947,6 @@ void wxGenericGrid::AdjustScrollbars(void)
|
||||
{
|
||||
noVertSteps = 0;
|
||||
int heightCount = 0;
|
||||
/*
|
||||
if (GetLabelSize(wxHORIZONTAL) > 0)
|
||||
noVertSteps ++;
|
||||
*/
|
||||
|
||||
int i;
|
||||
int ny = 0;
|
||||
@@ -989,20 +972,20 @@ void wxGenericGrid::AdjustScrollbars(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_hScrollBar )
|
||||
m_hScrollBar->Show(TRUE);
|
||||
if ( m_hScrollBar )
|
||||
m_hScrollBar->Show(TRUE);
|
||||
}
|
||||
|
||||
if (m_totalGridHeight + horizScrollBarHeight <= ch)
|
||||
{
|
||||
if ( m_vScrollBar )
|
||||
m_vScrollBar->Show(FALSE);
|
||||
SetScrollPosY(0);
|
||||
if ( m_vScrollBar )
|
||||
m_vScrollBar->Show(FALSE);
|
||||
SetScrollPosY(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_vScrollBar )
|
||||
m_vScrollBar->Show(TRUE);
|
||||
if ( m_vScrollBar )
|
||||
m_vScrollBar->Show(TRUE);
|
||||
}
|
||||
|
||||
UpdateDimensions(); // Necessary in case m_scrollPosX/Y changed
|
||||
@@ -1017,12 +1000,7 @@ void wxGenericGrid::AdjustScrollbars(void)
|
||||
if (m_hScrollBar)
|
||||
{
|
||||
int nCols = GetCols();
|
||||
/*
|
||||
m_hScrollBar->SetPageSize(wxMax(noHorizSteps, 1));
|
||||
m_hScrollBar->SetViewLength(wxMax(noHorizSteps, 1));
|
||||
m_hScrollBar->SetObjectLength(nCols);
|
||||
*/
|
||||
m_hScrollBar->SetScrollbar(m_hScrollBar->GetPosition(), wxMax(noHorizSteps, 1), nCols, wxMax(noHorizSteps, 1));
|
||||
m_hScrollBar->SetScrollbar(m_hScrollBar->GetPosition(), wxMax(noHorizSteps, 1), (noHorizSteps == 0) ? 1 : nCols, wxMax(noHorizSteps, 1));
|
||||
|
||||
m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth -2,
|
||||
cw - vertScrollBarWidth - m_leftOfSheet, m_scrollWidth);
|
||||
@@ -1031,13 +1009,8 @@ void wxGenericGrid::AdjustScrollbars(void)
|
||||
if (m_vScrollBar)
|
||||
{
|
||||
int nRows = GetRows();
|
||||
/*
|
||||
m_vScrollBar->SetPageSize(wxMax(noVertSteps, 1));
|
||||
m_vScrollBar->SetViewLength(wxMax(noVertSteps, 1));
|
||||
m_vScrollBar->SetObjectLength(nRows);
|
||||
*/
|
||||
|
||||
m_vScrollBar->SetScrollbar(m_vScrollBar->GetPosition(), wxMax(noVertSteps, 1), nRows, wxMax(noVertSteps, 1));
|
||||
m_vScrollBar->SetScrollbar(m_vScrollBar->GetPosition(), wxMax(noVertSteps, 1), (noVertSteps == 0) ? 1 : nRows, wxMax(noVertSteps, 1));
|
||||
m_vScrollBar->SetSize(cw - m_scrollWidth, m_topOfSheet,
|
||||
m_scrollWidth, ch - m_topOfSheet - horizScrollBarHeight);
|
||||
}
|
||||
@@ -2444,6 +2417,7 @@ void wxGenericGrid::OnGridScroll(wxScrollEvent& ev)
|
||||
}
|
||||
|
||||
win->UpdateDimensions();
|
||||
|
||||
win->SetCurrentRect(win->GetCursorRow(), win->GetCursorColumn());
|
||||
|
||||
// Because rows and columns can be arbitrary sizes,
|
||||
|
@@ -16,6 +16,8 @@
|
||||
#include "wx/setup.h"
|
||||
#include "wx/accel.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/utils.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#if !USE_SHARED_LIBRARIES
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
|
||||
@@ -28,66 +30,89 @@ public:
|
||||
wxAcceleratorRefData();
|
||||
~wxAcceleratorRefData();
|
||||
|
||||
/* TODO: implementation
|
||||
inline HACCEL GetHACCEL() const { return m_hAccel; }
|
||||
protected:
|
||||
HACCEL m_hAccel;
|
||||
*/
|
||||
public:
|
||||
int m_count;
|
||||
wxAcceleratorEntry* m_entries;
|
||||
};
|
||||
|
||||
#define M_ACCELDATA ((wxAcceleratorRefData *)m_refData)
|
||||
|
||||
wxAcceleratorRefData::wxAcceleratorRefData()
|
||||
{
|
||||
// TODO
|
||||
/*
|
||||
HACCEL m_hAccel;
|
||||
*/
|
||||
m_count = 0;
|
||||
m_entries = (wxAcceleratorEntry*) NULL;
|
||||
}
|
||||
|
||||
wxAcceleratorRefData::~wxAcceleratorRefData()
|
||||
{
|
||||
/*
|
||||
if (m_hAccel)
|
||||
{
|
||||
DestroyAcceleratorTable((HACCEL) m_hAccel);
|
||||
}
|
||||
m_hAccel = 0 ;
|
||||
*/
|
||||
delete[] m_entries;
|
||||
m_entries = (wxAcceleratorEntry*) NULL;
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
wxAcceleratorTable::wxAcceleratorTable()
|
||||
{
|
||||
m_refData = NULL;
|
||||
m_refData = (wxAcceleratorRefData*) NULL;
|
||||
}
|
||||
|
||||
wxAcceleratorTable::~wxAcceleratorTable()
|
||||
{
|
||||
// Data deleted in ~wxObject
|
||||
}
|
||||
|
||||
// Load from .rc resource
|
||||
wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
|
||||
{
|
||||
m_refData = new wxAcceleratorRefData;
|
||||
|
||||
/* TODO: load acelerator from resource, if appropriate for your platform
|
||||
M_ACCELDATA->m_hAccel = hAccel;
|
||||
M_ACCELDATA->m_ok = (hAccel != 0);
|
||||
*/
|
||||
}
|
||||
|
||||
// Create from an array
|
||||
wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
|
||||
{
|
||||
m_refData = new wxAcceleratorRefData;
|
||||
wxAcceleratorRefData* data = new wxAcceleratorRefData;
|
||||
m_refData = data;
|
||||
|
||||
data->m_count = n;
|
||||
data->m_entries = new wxAcceleratorEntry[n];
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
data->m_entries[i] = entries[i];
|
||||
|
||||
/* TODO: create table from entries
|
||||
*/
|
||||
}
|
||||
|
||||
bool wxAcceleratorTable::Ok() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
return (m_refData != (wxAcceleratorRefData*) NULL);
|
||||
}
|
||||
|
||||
int wxAcceleratorTable::GetCount() const
|
||||
{
|
||||
return M_ACCELDATA->m_count;
|
||||
}
|
||||
|
||||
wxAcceleratorEntry* wxAcceleratorTable::GetEntries() const
|
||||
{
|
||||
return M_ACCELDATA->m_entries;
|
||||
}
|
||||
|
||||
// Implementation use only
|
||||
bool wxAcceleratorEntry::MatchesEvent(const wxKeyEvent& event) const
|
||||
{
|
||||
bool eventAltDown = event.AltDown();
|
||||
bool eventCtrlDown = event.ControlDown();
|
||||
bool eventShiftDown = event.ShiftDown();
|
||||
int eventKeyCode = event.KeyCode();
|
||||
|
||||
bool accAltDown = ((GetFlags() & wxACCEL_ALT) == wxACCEL_ALT);
|
||||
bool accCtrlDown = ((GetFlags() & wxACCEL_CTRL) == wxACCEL_CTRL);
|
||||
bool accShiftDown = ((GetFlags() & wxACCEL_SHIFT) == wxACCEL_SHIFT);
|
||||
int accKeyCode = GetKeyCode();
|
||||
int accKeyCode2 = GetKeyCode();
|
||||
if (isascii(accKeyCode2))
|
||||
accKeyCode2 = wxToLower(accKeyCode2);
|
||||
|
||||
return ((eventAltDown == accAltDown) && (eventCtrlDown == accCtrlDown) &&
|
||||
(eventShiftDown == accShiftDown) &&
|
||||
((eventKeyCode == accKeyCode || eventKeyCode == accKeyCode2))) ;
|
||||
}
|
||||
|
||||
|
@@ -281,36 +281,55 @@ int wxApp::MainLoop()
|
||||
while (m_keepGoing)
|
||||
{
|
||||
XtAppNextEvent( (XtAppContext) wxTheApp->GetAppContext(), &event);
|
||||
if(event.type == PropertyNotify)
|
||||
{
|
||||
HandlePropertyChange((WXEvent*) &event);
|
||||
} else
|
||||
{
|
||||
// Terry Gitnick <terryg@scientech.com> - 1/21/98
|
||||
/* if resize event, don't resize until the last resize event for this
|
||||
window is recieved. Prevents flicker as windows are resized. */
|
||||
if (event.type == ResizeRequest)
|
||||
{
|
||||
Display *disp = XtDisplay((Widget) wxTheApp->GetTopLevelWidget());
|
||||
Window win = event.xany.window;
|
||||
XEvent report;
|
||||
|
||||
// to avoid flicker
|
||||
report = event;
|
||||
while( XCheckTypedWindowEvent (disp, win, ResizeRequest, &report));
|
||||
}
|
||||
// TODO: when implementing refresh optimization, we can use
|
||||
// XtAddExposureToRegion to expand the window's paint region.
|
||||
|
||||
XtDispatchEvent(&event);
|
||||
|
||||
ProcessIdle();
|
||||
}
|
||||
ProcessXEvent((WXEvent*) & event);
|
||||
ProcessIdle();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Processes an X event.
|
||||
void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
{
|
||||
XEvent* event = (XEvent*) _event;
|
||||
|
||||
if (CheckForAccelerator(_event))
|
||||
{
|
||||
// Do nothing! We intercepted and processed the event as an accelerator.
|
||||
return;
|
||||
}
|
||||
else if (event->type == PropertyNotify)
|
||||
{
|
||||
HandlePropertyChange(_event);
|
||||
return;
|
||||
}
|
||||
else if (event->type == ResizeRequest)
|
||||
{
|
||||
/* Terry Gitnick <terryg@scientech.com> - 1/21/98
|
||||
* If resize event, don't resize until the last resize event for this
|
||||
* window is recieved. Prevents flicker as windows are resized.
|
||||
*/
|
||||
|
||||
Display *disp = XtDisplay((Widget) wxTheApp->GetTopLevelWidget());
|
||||
Window win = event->xany.window;
|
||||
XEvent report;
|
||||
|
||||
// to avoid flicker
|
||||
report = * event;
|
||||
while( XCheckTypedWindowEvent (disp, win, ResizeRequest, &report));
|
||||
|
||||
// TODO: when implementing refresh optimization, we can use
|
||||
// XtAddExposureToRegion to expand the window's paint region.
|
||||
|
||||
XtDispatchEvent(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
XtDispatchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns TRUE if more time is needed.
|
||||
bool wxApp::ProcessIdle()
|
||||
{
|
||||
@@ -330,13 +349,20 @@ void wxApp::ExitMainLoop()
|
||||
bool wxApp::Pending()
|
||||
{
|
||||
XFlush(XtDisplay( (Widget) wxTheApp->GetTopLevelWidget() ));
|
||||
return (XtAppPending( (XtAppContext) wxTheApp->GetAppContext() ) != 0) ;
|
||||
|
||||
// Fix by Doug from STI, to prevent a stall if non-X event
|
||||
// is found.
|
||||
return ((XtAppPending( (XtAppContext) GetAppContext() ) & XtIMXEvent) != 0) ;
|
||||
}
|
||||
|
||||
// Dispatch a message.
|
||||
void wxApp::Dispatch()
|
||||
{
|
||||
XtAppProcessEvent( (XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
|
||||
// XtAppProcessEvent( (XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
|
||||
|
||||
XEvent event;
|
||||
XtAppNextEvent((XtAppContext) GetAppContext(), &event);
|
||||
ProcessXEvent((WXEvent*) & event);
|
||||
}
|
||||
|
||||
// This should be redefined in a derived class for
|
||||
@@ -496,6 +522,41 @@ WXColormap wxApp::GetMainColormap(WXDisplay* display)
|
||||
return (WXColormap) c;
|
||||
}
|
||||
|
||||
// Returns TRUE if an accelerator has been processed
|
||||
bool wxApp::CheckForAccelerator(WXEvent* event)
|
||||
{
|
||||
XEvent* xEvent = (XEvent*) event;
|
||||
if (xEvent->xany.type == KeyPress)
|
||||
{
|
||||
// Find a wxWindow for this window
|
||||
// TODO: should get display for the window, not the current display
|
||||
Widget widget = XtWindowToWidget((Display*) wxGetDisplay(), xEvent->xany.window);
|
||||
wxWindow* win = NULL;
|
||||
|
||||
// Find the first wxWindow that corresponds to this event window
|
||||
while (widget && !(win = wxGetWindowFromTable(widget)))
|
||||
widget = XtParent(widget);
|
||||
|
||||
if (!widget || !win)
|
||||
return FALSE;
|
||||
|
||||
wxKeyEvent keyEvent(wxEVT_CHAR);
|
||||
wxTranslateKeyEvent(keyEvent, win, (Widget) 0, xEvent);
|
||||
|
||||
// Now we have a wxKeyEvent and we have a wxWindow.
|
||||
// Go up the hierarchy until we find a matching accelerator,
|
||||
// or we get to the top.
|
||||
while (win)
|
||||
{
|
||||
if (win->ProcessAccelerator(keyEvent))
|
||||
return TRUE;
|
||||
win = win->GetParent();
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxExit()
|
||||
{
|
||||
int retValue = 0;
|
||||
|
@@ -145,14 +145,17 @@ wxChoice::~wxChoice()
|
||||
if (m_widgetList)
|
||||
delete[] m_widgetList;
|
||||
|
||||
DetachWidget(GetMainWidget()); // Removes event handlers
|
||||
if (GetMainWidget())
|
||||
{
|
||||
DetachWidget(GetMainWidget()); // Removes event handlers
|
||||
|
||||
XtDestroyWidget((Widget) m_formWidget);
|
||||
m_formWidget = (WXWidget) 0;
|
||||
XtDestroyWidget((Widget) m_formWidget);
|
||||
m_formWidget = (WXWidget) 0;
|
||||
|
||||
// Presumably the other widgets have been deleted now, via the form
|
||||
m_mainWidget = (WXWidget) 0;
|
||||
m_buttonWidget = (WXWidget) 0;
|
||||
// Presumably the other widgets have been deleted now, via the form
|
||||
m_mainWidget = (WXWidget) 0;
|
||||
m_buttonWidget = (WXWidget) 0;
|
||||
}
|
||||
}
|
||||
|
||||
void wxChoice::Append(const wxString& item)
|
||||
|
@@ -94,6 +94,19 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxComboBox::~wxComboBox()
|
||||
{
|
||||
DetachWidget((Widget) m_mainWidget); // Removes event handlers
|
||||
XtDestroyWidget((Widget) m_mainWidget);
|
||||
m_mainWidget = (WXWidget) 0;
|
||||
}
|
||||
|
||||
void wxComboBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// Necessary so it doesn't call wxChoice::SetSize
|
||||
wxWindow::SetSize(x, y, width, height, sizeFlags);
|
||||
}
|
||||
|
||||
wxString wxComboBox::GetValue() const
|
||||
{
|
||||
char *s = XmComboBoxGetString ((Widget) m_mainWidget);
|
||||
@@ -115,6 +128,97 @@ void wxComboBox::SetValue(const wxString& value)
|
||||
m_inSetValue = FALSE;
|
||||
}
|
||||
|
||||
void wxComboBox::Append(const wxString& item)
|
||||
{
|
||||
XmString str = XmStringCreateLtoR((char*) (const char*) item, XmSTRING_DEFAULT_CHARSET);
|
||||
XmComboBoxAddItem((Widget) m_mainWidget, str, 0);
|
||||
m_stringList.Add(item);
|
||||
XmStringFree(str);
|
||||
m_noStrings ++;
|
||||
}
|
||||
|
||||
void wxComboBox::Delete(int n)
|
||||
{
|
||||
XmComboBoxDeletePos((Widget) m_mainWidget, n-1);
|
||||
wxNode *node = m_stringList.Nth(n);
|
||||
if (node)
|
||||
{
|
||||
delete[] (char *)node->Data();
|
||||
delete node;
|
||||
}
|
||||
m_noStrings--;
|
||||
}
|
||||
|
||||
void wxComboBox::Clear()
|
||||
{
|
||||
XmComboBoxDeleteAllItems((Widget) m_mainWidget);
|
||||
m_stringList.Clear();
|
||||
}
|
||||
|
||||
void wxComboBox::SetSelection (int n)
|
||||
{
|
||||
XmComboBoxSelectPos((Widget) m_mainWidget, n+1, False);
|
||||
}
|
||||
|
||||
int wxComboBox::GetSelection (void) const
|
||||
{
|
||||
int sel = XmComboBoxGetSelectedPos((Widget) m_mainWidget);
|
||||
if (sel == 0)
|
||||
return -1;
|
||||
else
|
||||
return sel - 1;
|
||||
}
|
||||
|
||||
wxString wxComboBox::GetString(int n) const
|
||||
{
|
||||
wxNode *node = m_stringList.Nth (n);
|
||||
if (node)
|
||||
return wxString((char *) node->Data ());
|
||||
else
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
wxString wxComboBox::GetStringSelection() const
|
||||
{
|
||||
int sel = GetSelection();
|
||||
if (sel == -1)
|
||||
return wxEmptyString;
|
||||
else
|
||||
return GetString(sel);
|
||||
}
|
||||
|
||||
bool wxComboBox::SetStringSelection(const wxString& sel)
|
||||
{
|
||||
int n = FindString(sel);
|
||||
if (n == -1)
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
SetSelection(n);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
int wxComboBox::FindString(const wxString& s) const
|
||||
{
|
||||
int *pos_list = NULL;
|
||||
int count = 0;
|
||||
XmString text = XmStringCreateSimple ((char*) (const char*) s);
|
||||
bool found = (XmComboBoxGetMatchPos((Widget) m_mainWidget,
|
||||
text, &pos_list, &count) != 0);
|
||||
|
||||
XmStringFree(text);
|
||||
|
||||
if (found && count > 0)
|
||||
{
|
||||
int pos = pos_list[0] - 1;
|
||||
free(pos_list);
|
||||
return pos;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Clipboard operations
|
||||
void wxComboBox::Copy()
|
||||
{
|
||||
|
@@ -480,7 +480,10 @@ int wxDialog::ShowModal()
|
||||
// Loop until we signal that the dialog should be closed
|
||||
while ((wxModalShowingStack.Number() > 0) && (bool)wxModalShowingStack.First()->Data())
|
||||
{
|
||||
XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
|
||||
// XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
|
||||
|
||||
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
||||
wxTheApp->ProcessXEvent((WXEvent*) &event);
|
||||
}
|
||||
|
||||
// Remove modal dialog flag from stack
|
||||
@@ -494,7 +497,8 @@ int wxDialog::ShowModal()
|
||||
{
|
||||
XFlush(XtDisplay((Widget) wxTheApp->GetTopLevelWidget()));
|
||||
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
|
||||
XtDispatchEvent(&event);
|
||||
|
||||
wxTheApp->ProcessXEvent((WXEvent*) &event);
|
||||
}
|
||||
|
||||
// TODO: is it safe to call this, if the dialog may have been deleted
|
||||
|
@@ -375,6 +375,9 @@ void _XsMotifCorner::_expose (XEvent*)
|
||||
{
|
||||
Dimension w, h;
|
||||
|
||||
if (_topShadowGC == 0) // JACS
|
||||
return;
|
||||
|
||||
// Get the size of the corner
|
||||
|
||||
XtVaGetValues (_base, XmNwidth, &w, XmNheight, &h, NULL);
|
||||
@@ -612,6 +615,8 @@ const char *_XsMotifSide::className ( ) const
|
||||
|
||||
void _XsMotifSide::_expose (XEvent *event)
|
||||
{
|
||||
if (_topShadowGC == 0) // JACS
|
||||
return;
|
||||
|
||||
// Clear out the window first
|
||||
|
||||
@@ -847,6 +852,9 @@ const char *_XsMotifButton::className ( ) const
|
||||
|
||||
void _XsMotifButton::_expose (XEvent *event)
|
||||
{
|
||||
if (_topShadowGC == 0) // JACS
|
||||
return;
|
||||
|
||||
Dimension w, h;
|
||||
|
||||
// Get the size of the button
|
||||
@@ -1152,6 +1160,8 @@ void _XsMotifTitle::_redraw ( )
|
||||
|
||||
void _XsMotifTitle::_expose (XEvent *event)
|
||||
{
|
||||
if (_topShadowGC == 0) // JACS
|
||||
return;
|
||||
|
||||
// Clear out the window first
|
||||
|
||||
@@ -1646,6 +1656,9 @@ void _XsMotifIcon::_input (XEvent *event)
|
||||
|
||||
void _XsMotifIcon::_expose (XEvent *)
|
||||
{
|
||||
if (_topShadowGC == 0) // JACS
|
||||
return;
|
||||
|
||||
Dimension iconHeight;
|
||||
Dimension iconWidth;
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <wx/motif/private.h>
|
||||
|
||||
void wxScrollBarCallback(Widget widget, XtPointer clientData,
|
||||
static void wxScrollBarCallback(Widget widget, XtPointer clientData,
|
||||
XmScaleCallbackStruct *cbs);
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
@@ -167,7 +167,7 @@ void wxScrollBar::ChangeForegroundColour()
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxScrollBarCallback(Widget widget, XtPointer clientData,
|
||||
static void wxScrollBarCallback(Widget widget, XtPointer clientData,
|
||||
XmScaleCallbackStruct *cbs)
|
||||
{
|
||||
wxScrollBar *scrollBar = (wxScrollBar *)clientData;
|
||||
|
@@ -181,7 +181,9 @@ wxString wxTextCtrl::GetValue() const
|
||||
|
||||
void wxTextCtrl::SetValue(const wxString& value)
|
||||
{
|
||||
wxASSERT_MSG( (!value.IsNull()), "Must not pass a null string to wxTextCtrl::SetValue." ) ;
|
||||
// This assert is wrong -- means that you can't set an empty
|
||||
// string (IsNull == IsEmpty).
|
||||
// wxASSERT_MSG( (!value.IsNull()), "Must not pass a null string to wxTextCtrl::SetValue." ) ;
|
||||
m_inSetValue = TRUE;
|
||||
|
||||
XmTextSetString ((Widget) m_mainWidget, (char*) (const char*) value);
|
||||
|
@@ -52,7 +52,7 @@ void wxCanvasRepaintProc (Widget, XtPointer, XmDrawingAreaCallbackStruct * cbs);
|
||||
void wxCanvasInputEvent (Widget drawingArea, XtPointer data, XmDrawingAreaCallbackStruct * cbs);
|
||||
void wxCanvasMotionEvent (Widget, XButtonEvent * event);
|
||||
void wxCanvasEnterLeave (Widget drawingArea, XtPointer clientData, XCrossingEvent * event);
|
||||
void wxScrollBarCallback(Widget widget, XtPointer clientData,
|
||||
static void wxScrollBarCallback(Widget widget, XtPointer clientData,
|
||||
XmScaleCallbackStruct *cbs);
|
||||
void wxPanelItemEventHandler (Widget wid,
|
||||
XtPointer client_data,
|
||||
@@ -2735,7 +2735,7 @@ void wxPanelItemEventHandler (Widget wid,
|
||||
*continueToDispatch = True;
|
||||
}
|
||||
|
||||
void wxScrollBarCallback(Widget scrollbar, XtPointer clientData,
|
||||
static void wxScrollBarCallback(Widget scrollbar, XtPointer clientData,
|
||||
XmScaleCallbackStruct *cbs)
|
||||
{
|
||||
Widget scrolledWindow = XtParent (scrollbar);
|
||||
@@ -3111,3 +3111,72 @@ void wxWindow::ClearUpdateRects()
|
||||
}
|
||||
m_updateRects.Clear();
|
||||
}
|
||||
|
||||
bool wxWindow::ProcessAccelerator(wxKeyEvent& event)
|
||||
{
|
||||
if (!m_acceleratorTable.Ok())
|
||||
return FALSE;
|
||||
|
||||
int count = m_acceleratorTable.GetCount();
|
||||
wxAcceleratorEntry* entries = m_acceleratorTable.GetEntries();
|
||||
int i;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
wxAcceleratorEntry* entry = & (entries[i]);
|
||||
if (entry->MatchesEvent(event))
|
||||
{
|
||||
// Bingo, we have a match. Now find a control
|
||||
// that matches the entry command id.
|
||||
|
||||
// Need to go up to the top of the window hierarchy,
|
||||
// since it might be e.g. a menu item
|
||||
wxWindow* parent = this;
|
||||
while (parent && !parent->IsKindOf(CLASSINFO(wxFrame)) && !parent->IsKindOf(CLASSINFO(wxDialog)))
|
||||
parent = parent->GetParent();
|
||||
|
||||
if (!parent)
|
||||
return FALSE;
|
||||
|
||||
if (parent->IsKindOf(CLASSINFO(wxFrame)))
|
||||
{
|
||||
// Try for a menu command
|
||||
wxFrame* frame = (wxFrame*) parent;
|
||||
if (frame->GetMenuBar())
|
||||
{
|
||||
wxMenuItem* item = frame->GetMenuBar()->FindItemForId(entry->GetCommand());
|
||||
if (item)
|
||||
{
|
||||
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, entry->GetCommand());
|
||||
commandEvent.SetEventObject(frame);
|
||||
|
||||
// If ProcessEvent returns TRUE (it was handled), then
|
||||
// the calling code will skip the event handling.
|
||||
return frame->GetEventHandler()->ProcessEvent(commandEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find a child matching the command id
|
||||
wxWindow* child = parent->FindWindow(entry->GetCommand());
|
||||
|
||||
// No such child
|
||||
if (!child)
|
||||
return FALSE;
|
||||
|
||||
// Now we process those kinds of windows that we can.
|
||||
// For now, only buttons.
|
||||
if (child->IsKindOf(CLASSINFO(wxButton)))
|
||||
{
|
||||
wxCommandEvent commandEvent (wxEVT_COMMAND_BUTTON_CLICKED, child->GetId());
|
||||
commandEvent.SetEventObject(child);
|
||||
return child->GetEventHandler()->ProcessEvent(commandEvent);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
} // matches event
|
||||
}// for
|
||||
|
||||
// We didn't match the key event against an accelerator.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -114,3 +114,52 @@ void wxComboBox::SetSelection(long from, long to)
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::Append(const wxString& item)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::Delete(int n)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::Clear()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxComboBox::GetSelection() const
|
||||
{
|
||||
// TODO
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxComboBox::SetSelection(int n)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxComboBox::FindString(const wxString& s) const
|
||||
{
|
||||
// TODO
|
||||
return -1;
|
||||
}
|
||||
|
||||
wxString wxComboBox::GetString(int n) const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
wxString wxComboBox::GetStringSelection() const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
bool wxComboBox::SetStringSelection(const wxString& sel)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user