wxBeginBusyCursor now works (better)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -273,7 +273,7 @@ wxShell(const wxString& command)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
|
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
|
||||||
long wxGetFreeMemory(void)
|
long wxGetFreeMemory()
|
||||||
{
|
{
|
||||||
#if defined(__WIN32__) && !defined(__BORLANDC__) && !defined(__TWIN32__)
|
#if defined(__WIN32__) && !defined(__BORLANDC__) && !defined(__TWIN32__)
|
||||||
MEMORYSTATUS memStatus;
|
MEMORYSTATUS memStatus;
|
||||||
@@ -290,7 +290,7 @@ static bool inTimer = FALSE;
|
|||||||
class wxSleepTimer: public wxTimer
|
class wxSleepTimer: public wxTimer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline void Notify(void)
|
inline void Notify()
|
||||||
{
|
{
|
||||||
inTimer = FALSE;
|
inTimer = FALSE;
|
||||||
Stop();
|
Stop();
|
||||||
@@ -321,7 +321,7 @@ void wxSleep(int nSecs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Consume all events until no more left
|
// Consume all events until no more left
|
||||||
void wxFlushEvents(void)
|
void wxFlushEvents()
|
||||||
{
|
{
|
||||||
// wxYield();
|
// wxYield();
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ void wxFatalError(const wxString& msg, const wxString& title)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit a beeeeeep
|
// Emit a beeeeeep
|
||||||
void wxBell(void)
|
void wxBell()
|
||||||
{
|
{
|
||||||
// Removed by RD because IHMO syncronous sound is a Bad Thing. MessageBeep
|
// Removed by RD because IHMO syncronous sound is a Bad Thing. MessageBeep
|
||||||
// will do a similar thing anyway if there is no sound card...
|
// will do a similar thing anyway if there is no sound card...
|
||||||
@@ -512,44 +512,47 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_RESOURCES
|
#endif // wxUSE_RESOURCES
|
||||||
|
|
||||||
// Old cursor
|
// ---------------------------------------------------------------------------
|
||||||
static HCURSOR wxBusyCursorOld = 0;
|
// helper functiosn for showing a "busy" cursor
|
||||||
static int wxBusyCursorCount = 0;
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern HCURSOR gs_wxBusyCursor = 0; // new, busy cursor
|
||||||
|
static HCURSOR gs_wxBusyCursorOld = 0; // old cursor
|
||||||
|
static int gs_wxBusyCursorCount = 0;
|
||||||
|
|
||||||
// Set the cursor to the busy cursor for all windows
|
// Set the cursor to the busy cursor for all windows
|
||||||
void wxBeginBusyCursor(wxCursor *cursor)
|
void wxBeginBusyCursor(wxCursor *cursor)
|
||||||
{
|
{
|
||||||
wxBusyCursorCount ++;
|
if ( gs_wxBusyCursorCount++ == 0 )
|
||||||
if (wxBusyCursorCount == 1)
|
{
|
||||||
{
|
gs_wxBusyCursor = (HCURSOR)cursor->GetHCURSOR();
|
||||||
wxBusyCursorOld = ::SetCursor((HCURSOR) cursor->GetHCURSOR());
|
gs_wxBusyCursorOld = ::SetCursor(gs_wxBusyCursor);
|
||||||
}
|
}
|
||||||
else
|
//else: nothing to do, already set
|
||||||
{
|
|
||||||
(void)::SetCursor((HCURSOR) cursor->GetHCURSOR());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore cursor to normal
|
// Restore cursor to normal
|
||||||
void wxEndBusyCursor(void)
|
void wxEndBusyCursor()
|
||||||
{
|
{
|
||||||
if (wxBusyCursorCount == 0)
|
wxCHECK_RET( gs_wxBusyCursorCount > 0,
|
||||||
return;
|
"no matching wxBeginBusyCursor() for wxEndBusyCursor()" );
|
||||||
|
|
||||||
wxBusyCursorCount --;
|
gs_wxBusyCursorCount--;
|
||||||
if (wxBusyCursorCount == 0)
|
if ( --gs_wxBusyCursorCount == 0 )
|
||||||
{
|
{
|
||||||
::SetCursor(wxBusyCursorOld);
|
::SetCursor(gs_wxBusyCursorOld);
|
||||||
wxBusyCursorOld = 0;
|
|
||||||
}
|
gs_wxBusyCursorOld = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TRUE if we're between the above two calls
|
// TRUE if we're between the above two calls
|
||||||
bool wxIsBusy(void)
|
bool wxIsBusy()
|
||||||
{
|
{
|
||||||
return (wxBusyCursorCount > 0);
|
return (gs_wxBusyCursorCount > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
const char* wxGetHomeDir(wxString *pstr)
|
const char* wxGetHomeDir(wxString *pstr)
|
||||||
{
|
{
|
||||||
wxString& strDir = *pstr;
|
wxString& strDir = *pstr;
|
||||||
@@ -652,7 +655,8 @@ bool wxCheckForInterrupt(wxWindow *wnd)
|
|||||||
return TRUE;//*** temporary?
|
return TRUE;//*** temporary?
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
wxError("wnd==NULL !!!");
|
wxFAIL_MSG("wnd==NULL !!!");
|
||||||
|
|
||||||
return FALSE;//*** temporary?
|
return FALSE;//*** temporary?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -706,7 +710,7 @@ void wxGetMousePosition( int* x, int* y )
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Return TRUE if we have a colour display
|
// Return TRUE if we have a colour display
|
||||||
bool wxColourDisplay(void)
|
bool wxColourDisplay()
|
||||||
{
|
{
|
||||||
HDC dc = ::GetDC((HWND) NULL);
|
HDC dc = ::GetDC((HWND) NULL);
|
||||||
bool flag;
|
bool flag;
|
||||||
@@ -720,7 +724,7 @@ bool wxColourDisplay(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns depth of screen
|
// Returns depth of screen
|
||||||
int wxDisplayDepth(void)
|
int wxDisplayDepth()
|
||||||
{
|
{
|
||||||
HDC dc = ::GetDC((HWND) NULL);
|
HDC dc = ::GetDC((HWND) NULL);
|
||||||
int planes = GetDeviceCaps(dc, PLANES);
|
int planes = GetDeviceCaps(dc, PLANES);
|
||||||
|
@@ -231,6 +231,8 @@ void wxWindow::SetHWND(WXHWND hWnd)
|
|||||||
|
|
||||||
void wxWindow::Init()
|
void wxWindow::Init()
|
||||||
{
|
{
|
||||||
|
m_isWindow = TRUE;
|
||||||
|
|
||||||
// Generic
|
// Generic
|
||||||
m_windowId = 0;
|
m_windowId = 0;
|
||||||
m_isShown = TRUE;
|
m_isShown = TRUE;
|
||||||
@@ -1483,6 +1485,20 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
case WM_GETDLGCODE:
|
case WM_GETDLGCODE:
|
||||||
return MSWGetDlgCode();
|
return MSWGetDlgCode();
|
||||||
|
|
||||||
|
case WM_SETCURSOR:
|
||||||
|
if ( wxIsBusy() )
|
||||||
|
{
|
||||||
|
extern HCURSOR gs_wxBusyCursor; // from msw\utils.cpp
|
||||||
|
|
||||||
|
::SetCursor(gs_wxBusyCursor);
|
||||||
|
|
||||||
|
// returning TRUE stops the DefWindowProc() from further processing
|
||||||
|
// this message - exactly what we need because we've just set the
|
||||||
|
// cursor
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
break; // leave it to DefWindowProc()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return MSWDefWindowProc(message, wParam, lParam );
|
return MSWDefWindowProc(message, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user