From: Julian Smart Date: Thu, 12 Aug 1999 20:18:18 +0000 (+0000) Subject: wxBook additions; added a couple of pixels in menu drawing; taskbar X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c7527e3f2178b3a527c50ffda6bb059f8ff8acce wxBook additions; added a couple of pixels in menu drawing; taskbar PopupMenu improvements git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/html/wxbook.htm b/docs/html/wxbook.htm index 26ea676027..c40507fe9a 100644 --- a/docs/html/wxbook.htm +++ b/docs/html/wxbook.htm @@ -79,6 +79,12 @@ So far, the following people are interested in taking part in this project:

  • Julian Smart.
  • Vadim Zeitlin. +
  • Vaclav Slavik. wxHTML section +
  • Stefan Csomor. the sequence of events i.e. which action provokes which event sequence, +this is implicit for the use on MSW, but very important for other systems; and porting to new platforms +
  • Karsten Ballueder. short tutorials on some useful +GNU tools, like autoconf/configure/make, programming +strategies, etc.
    @@ -114,6 +120,9 @@ in terms of a quickie job using the existing reference manual.

    Another publishing name to think of is O'Reilly. They would probably give us a lot of guidance for style, formatting, etc.

    +Roald Ribe writes: +"Thinking in Java +is published both as a PDF for internet (by the author) and in print by Prentice Hall."


    diff --git a/docs/latex/wx/time.tex b/docs/latex/wx/time.tex index 2e463e402b..85cd2a6055 100644 --- a/docs/latex/wx/time.tex +++ b/docs/latex/wx/time.tex @@ -18,25 +18,10 @@ with a new wxDateTime class in the near future. {\small \begin{verbatim} typedef unsigned short hourTy; -\end{verbatim}} - -{\small \begin{verbatim} typedef unsigned short minuteTy; -\end{verbatim}} - -{\small \begin{verbatim} typedef unsigned short secondTy; -\end{verbatim}} - -{\small \begin{verbatim} typedef unsigned long clockTy; -\end{verbatim}} - -{\small \begin{verbatim} enum tFormat { wx12h, wx24h }; -\end{verbatim}} - -{\small \begin{verbatim} enum tPrecision { wxStdMinSec, wxStdMin }; \end{verbatim}} diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 381c6d0456..499c4f4972 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -61,7 +61,7 @@ extern wxChar wxMDIFrameClassName[]; extern wxChar wxMDIChildFrameClassName[]; extern wxWindow *wxWndHook; // from window.cpp -extern wxList *wxWinHandleList; +extern void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win); static HWND invalidHandle = 0; @@ -640,7 +640,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, m_hWnd = (WXHWND)Return; wxWndHook = NULL; - wxWinHandleList->Append((long)GetHWND(), this); + wxAssociateWinWithHandle((HWND) GetHWND(), this); // VZ: what's this? an act of piracy? //SetWindowLong(GetHwnd(), 0, (long)this); diff --git a/src/msw/ownerdrw.cpp b/src/msw/ownerdrw.cpp index cefdc0e8e3..d60bc8c408 100644 --- a/src/msw/ownerdrw.cpp +++ b/src/msw/ownerdrw.cpp @@ -77,6 +77,10 @@ bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight) str += _T('W'); // 'W' is typically the widest letter dc.GetTextExtent(str, (long *)pwidth, (long *)pheight); + + // JACS: items still look too tightly packed, so adding 2 pixels. + (*pheight) = (*pheight) + 2; + m_nHeight = *pheight; // remember height for use in OnDrawItem return TRUE; @@ -86,6 +90,10 @@ bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight) // Win32 GDI functions and not wxWindows ones. Might help to whoever decides to // port this code to X. (VZ) +// JACS: TODO. Why does a disabled but highlighted item still +// get drawn embossed? How can we tell DrawState that we don't want the +// embossing? + #if defined(__WIN32__) && !defined(__SC__) && !defined(__TWIN32__) #define O_DRAW_NATIVE_API // comments below explain why I use it #endif diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index 0fa9ef3a20..36d0de6c52 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -158,6 +158,16 @@ bool wxTaskBarIcon::RemoveIcon(void) bool wxTaskBarIcon::PopupMenu(wxMenu *menu) //, int x, int y); { + // OK, so I know this isn't thread-friendly, but + // what to do? We need this check. + + static bool s_inPopup = FALSE; + + if (s_inPopup) + return FALSE; + + s_inPopup = TRUE; + bool rval = FALSE; wxWindow* win; int x, y; @@ -177,7 +187,9 @@ bool wxTaskBarIcon::PopupMenu(wxMenu *menu) //, int x, int y); win->PopEventHandler(FALSE); win->Destroy(); - //delete win; + delete win; + + s_inPopup = FALSE; return rval; } diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 956c30b92b..161cdf5374 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1719,6 +1719,12 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA // it with wxWindow stored in wxWndHook if ( !wnd && wxWndHook ) { +#if 0 // def __WXDEBUG__ + char buf[512]; + ::GetClassNameA((HWND) hWnd, buf, 512); + wxString className(buf); +#endif + wxAssociateWinWithHandle(hWnd, wxWndHook); wnd = wxWndHook; wxWndHook = NULL; @@ -2124,6 +2130,10 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd) return (wxWindow *)node->Data(); } +#if 0 // def __WXDEBUG__ +static int gs_AssociationCount = 0; +#endif + void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win) { // adding NULL hWnd is (first) surely a result of an error and @@ -2131,12 +2141,33 @@ void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win) wxCHECK_RET( hWnd != (HWND)NULL, _T("attempt to add a NULL hWnd to window list ignored") ); - if ( !wxWinHandleList->Find((long)hWnd) ) + + wxWindow *oldWin = wxFindWinFromHandle((WXHWND) hWnd); + if ( oldWin && (oldWin != win) ) + { + wxString str(win->GetClassInfo()->GetClassName()); + wxLogError("Bug! Found existing HWND %X for new window of class %s", (int) hWnd, (const char*) str); + } + else if (!oldWin) + { +#if 0 // def __WXDEBUG__ + gs_AssociationCount ++; + wxLogDebug("+ Association %d", gs_AssociationCount); +#endif + wxWinHandleList->Append((long)hWnd, win); + } } void wxRemoveHandleAssociation(wxWindow *win) { +#if 0 // def __WXDEBUG__ + if (wxWinHandleList->Member(win)) + { + wxLogDebug("- Association %d", gs_AssociationCount); + gs_AssociationCount --; + } +#endif wxWinHandleList->DeleteObject(win); } @@ -2284,7 +2315,18 @@ bool wxWindow::MSWCreate(int id, } wxWndHook = NULL; - wxWinHandleList->Append((long)m_hWnd, this); +#ifdef __WXDEBUG__ + wxNode* node = wxWinHandleList->Member(this); + if (node) + { + HWND hWnd = (HWND) node->GetKeyInteger(); + if (hWnd != (HWND) m_hWnd) + { + wxLogError("A second HWND association is being added for the same window!"); + } + } +#endif + wxAssociateWinWithHandle((HWND) m_hWnd, this); return TRUE; } @@ -3513,11 +3555,12 @@ void wxSetKeyboardHook(bool doIt) { wxTheKeyboardHookProc = MakeProcInstance((FARPROC) wxKeyboardHook, wxGetInstance()); wxTheKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) wxTheKeyboardHookProc, wxGetInstance(), + #if defined(__WIN32__) && !defined(__TWIN32__) GetCurrentThreadId()); // (DWORD)GetCurrentProcess()); // This is another possibility. Which is right? #else - GetCurrentTask()); + GetCurrentTask()); #endif } else