-bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
-{
- char *s = NULL;
- bool succ = wxGetResource(section, entry, (char **)&s, file);
- if (succ)
- {
- *value = (int)strtol(s, NULL, 10);
- delete[] s;
- return TRUE;
- }
- else return FALSE;
-}
-#endif // USE_RESOURCES
-
-static int wxBusyCursorCount = 0;
-
-// Set the cursor to the busy cursor for all windows
-void wxBeginBusyCursor(wxCursor *cursor)
-{
- wxBusyCursorCount ++;
- if (wxBusyCursorCount == 1)
- {
- // TODO
- }
- else
- {
- // TODO
- }
-}
-
-// Restore cursor to normal
-void wxEndBusyCursor()
-{
- if (wxBusyCursorCount == 0)
- return;
-
- wxBusyCursorCount --;
- if (wxBusyCursorCount == 0)
- {
- // TODO
- }
-}
-
-// TRUE if we're between the above two calls
-bool wxIsBusy()
-{
- return (wxBusyCursorCount > 0);
-}
-
-char *wxGetUserHome (const wxString& user)
-{
- // TODO
- return NULL;
-}
-
-// Check whether this window wants to process messages, e.g. Stop button
-// in long calculations.
-bool wxCheckForInterrupt(wxWindow *wnd)
-{
- // TODO
- return FALSE;
-}
-
-void wxGetMousePosition( int* x, int* y )
-{
- // TODO
-};
-
-// Return TRUE if we have a colour display
-bool wxColourDisplay()
-{
- // TODO
- return TRUE;
-}
-
-// Returns depth of screen
-int wxDisplayDepth()
-{
- // TODO
- return 0;
-}
-
-// Get size of display
-void wxDisplaySize(int *width, int *height)
-{
- // TODO
-}
-
-/* Configurable display in Motif */
-static WXDisplay *gs_currentDisplay = NULL;
-static wxString gs_displayName;
-
-WXDisplay *wxGetDisplay()
-{
- if (gs_currentDisplay)
- return gs_currentDisplay;
-
- return XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
-}
-
-bool wxSetDisplay(const wxString& display_name)
-{
- gs_displayName = display_name;
-
- if (display_name.IsNull() || display_name.IsEmpty())
- {
- gs_currentDisplay = NULL;
- return TRUE;
- }
- else
- {
- Cardinal argc = 0;
-
- Display *display = XtOpenDisplay((XtAppContext) wxTheApp->GetAppContext(),
- (const char*) display_name,
- (const char*) wxTheApp->GetAppName(),
- (const char*) wxTheApp->GetClassName(),
- NULL,
-# if XtSpecificationRelease < 5
- 0, &argc, NULL);
-# else
- 0, (int *)&argc, NULL);
-# endif
-
- if (display)
- {
- gs_currentDisplay = (WXDisplay*) display;
- return TRUE;
- } else
- return FALSE;
- }
- return FALSE;
-}
-
-wxString wxGetDisplayName()
-{
- return gs_displayName;
-}
-
-// Find the letter corresponding to the mnemonic, for Motif
-char wxFindMnemonic (const char *s)
-{
- char mnem = 0;
- int len = strlen (s);
- int i;
- for (i = 0; i < len; i++)
- {
- if (s[i] == '&')
- {
- // Carefully handle &&
- if ((i + 1) <= len && s[i + 1] == '&')
- i++;
- else
- {
- mnem = s[i + 1];
- break;
- }
- }
- }
- return mnem;
-}
-
-char * wxFindAccelerator (char *s)
-{
-// The accelerator text is after the \t char.
- while (*s && *s != '\t')
- s++;
- if (*s == '\0')
- return (NULL);
- s++;
-/*
- Now we need to format it as X standard:
-
- input output
-
- F7 --> <Key>F7
- Ctrl+N --> Ctrl<Key>N
- Alt+k --> Meta<Key>k
- Ctrl+Shift+A --> Ctrl Shift<Key>A
-
- */
-
- wxBuffer[0] = '\0';
- char *tmp = copystring (s);
- s = tmp;
- char *p = s;
-
- while (1)
- {
- while (*p && *p != '+')
- p++;
- if (*p)
- {
- *p = '\0';
- if (wxBuffer[0])
- strcat (wxBuffer, " ");
- if (strcmp (s, "Alt"))
- strcat (wxBuffer, s);
- else
- strcat (wxBuffer, "Meta");
- s = p + 1;
- p = s;
- }
- else
- {
- strcat (wxBuffer, "<Key>");
- strcat (wxBuffer, s);
- break;
- }
- }
- delete[]tmp;
- return wxBuffer;
-}
-
-XmString wxFindAcceleratorText (char *s)
-{
-// The accelerator text is after the \t char.
- while (*s && *s != '\t')
- s++;
- if (*s == '\0')
- return (NULL);
- s++;
- XmString text = XmStringCreateSimple (s);
- return text;
-}
-
-#include <X11/keysym.h>
-
-int wxCharCodeXToWX(KeySym keySym)
-{
- int id;
- switch (keySym) {
- case XK_Shift_L:
- case XK_Shift_R:
- id = WXK_SHIFT; break;
- case XK_Control_L:
- case XK_Control_R:
- id = WXK_CONTROL; break;
- case XK_BackSpace:
- id = WXK_BACK; break;
- case XK_Delete:
- id = WXK_DELETE; break;
- case XK_Clear:
- id = WXK_CLEAR; break;
- case XK_Tab:
- id = WXK_TAB; break;
- case XK_numbersign:
- id = '#'; break;
- case XK_Return:
- id = WXK_RETURN; break;
- case XK_Escape:
- id = WXK_ESCAPE; break;
- case XK_Pause:
- case XK_Break:
- id = WXK_PAUSE; break;
- case XK_Num_Lock:
- id = WXK_NUMLOCK; break;
- case XK_Scroll_Lock:
- id = WXK_SCROLL; break;
-
- case XK_Home:
- id = WXK_HOME; break;
- case XK_End:
- id = WXK_END; break;
- case XK_Left:
- id = WXK_LEFT; break;
- case XK_Right:
- id = WXK_RIGHT; break;
- case XK_Up:
- id = WXK_UP; break;
- case XK_Down:
- id = WXK_DOWN; break;
- case XK_Next:
- id = WXK_NEXT; break;
- case XK_Prior:
- id = WXK_PRIOR; break;
- case XK_Menu:
- id = WXK_MENU; break;
- case XK_Select:
- id = WXK_SELECT; break;
- case XK_Cancel:
- id = WXK_CANCEL; break;
- case XK_Print:
- id = WXK_PRINT; break;
- case XK_Execute:
- id = WXK_EXECUTE; break;
- case XK_Insert:
- id = WXK_INSERT; break;
- case XK_Help:
- id = WXK_HELP; break;