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
This commit is contained in:
Julian Smart
1999-08-12 20:18:18 +00:00
parent ad9edf45f1
commit c7527e3f21
6 changed files with 78 additions and 21 deletions

View File

@@ -79,6 +79,12 @@ So far, the following people are interested in taking part in this project:<P>
</i> </i>
<li><a href="mailto:julian.smart@ukonline.co.uk">Julian Smart</a>. <li><a href="mailto:julian.smart@ukonline.co.uk">Julian Smart</a>.
<li><a href="mailto:zeitlin@dptmaths.ens-cachan.fr">Vadim Zeitlin</a>. <li><a href="mailto:zeitlin@dptmaths.ens-cachan.fr">Vadim Zeitlin</a>.
<li><a href="mailto:slavik2@czn.cz">Vaclav Slavik</a>. <i>wxHTML section</i>
<li><a href="mailto:csomor@advancedconcepts.ch">Stefan Csomor</a>. <i>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</i>
<li><a href="mailto:karsten@phy.hw.ac.uk">Karsten Ballueder</a>. <i>short tutorials on some useful
GNU tools, like autoconf/configure/make, programming
strategies, etc.</i>
</ul> </ul>
<hr> <hr>
@@ -114,6 +120,9 @@ in terms of a quickie job using the existing reference manual.<P>
Another publishing name to think of is O'Reilly. They would probably give us a lot Another publishing name to think of is O'Reilly. They would probably give us a lot
of guidance for style, formatting, etc.<P> of guidance for style, formatting, etc.<P>
<a href="mailto:Roald.Ribe@winlink.no">Roald Ribe</a> writes:
"<a href="http://www.bruceeckel.com/javabook.html" target=_new>Thinking in Java</a>
is published both as a PDF for internet (by the author) and in print by Prentice Hall."<P>
<hr> <hr>

View File

@@ -18,25 +18,10 @@ with a new wxDateTime class in the near future.
{\small \begin{verbatim} {\small \begin{verbatim}
typedef unsigned short hourTy; typedef unsigned short hourTy;
\end{verbatim}}
{\small \begin{verbatim}
typedef unsigned short minuteTy; typedef unsigned short minuteTy;
\end{verbatim}}
{\small \begin{verbatim}
typedef unsigned short secondTy; typedef unsigned short secondTy;
\end{verbatim}}
{\small \begin{verbatim}
typedef unsigned long clockTy; typedef unsigned long clockTy;
\end{verbatim}}
{\small \begin{verbatim}
enum tFormat { wx12h, wx24h }; enum tFormat { wx12h, wx24h };
\end{verbatim}}
{\small \begin{verbatim}
enum tPrecision { wxStdMinSec, wxStdMin }; enum tPrecision { wxStdMinSec, wxStdMin };
\end{verbatim}} \end{verbatim}}

View File

@@ -61,7 +61,7 @@ extern wxChar wxMDIFrameClassName[];
extern wxChar wxMDIChildFrameClassName[]; extern wxChar wxMDIChildFrameClassName[];
extern wxWindow *wxWndHook; // from window.cpp extern wxWindow *wxWndHook; // from window.cpp
extern wxList *wxWinHandleList; extern void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win);
static HWND invalidHandle = 0; static HWND invalidHandle = 0;
@@ -640,7 +640,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
m_hWnd = (WXHWND)Return; m_hWnd = (WXHWND)Return;
wxWndHook = NULL; wxWndHook = NULL;
wxWinHandleList->Append((long)GetHWND(), this); wxAssociateWinWithHandle((HWND) GetHWND(), this);
// VZ: what's this? an act of piracy? // VZ: what's this? an act of piracy?
//SetWindowLong(GetHwnd(), 0, (long)this); //SetWindowLong(GetHwnd(), 0, (long)this);

View File

@@ -77,6 +77,10 @@ bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight)
str += _T('W'); // 'W' is typically the widest letter str += _T('W'); // 'W' is typically the widest letter
dc.GetTextExtent(str, (long *)pwidth, (long *)pheight); 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 m_nHeight = *pheight; // remember height for use in OnDrawItem
return TRUE; 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 // Win32 GDI functions and not wxWindows ones. Might help to whoever decides to
// port this code to X. (VZ) // 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__) #if defined(__WIN32__) && !defined(__SC__) && !defined(__TWIN32__)
#define O_DRAW_NATIVE_API // comments below explain why I use it #define O_DRAW_NATIVE_API // comments below explain why I use it
#endif #endif

View File

@@ -158,6 +158,16 @@ bool wxTaskBarIcon::RemoveIcon(void)
bool wxTaskBarIcon::PopupMenu(wxMenu *menu) //, int x, int y); 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; bool rval = FALSE;
wxWindow* win; wxWindow* win;
int x, y; int x, y;
@@ -177,7 +187,9 @@ bool wxTaskBarIcon::PopupMenu(wxMenu *menu) //, int x, int y);
win->PopEventHandler(FALSE); win->PopEventHandler(FALSE);
win->Destroy(); win->Destroy();
//delete win; delete win;
s_inPopup = FALSE;
return rval; return rval;
} }

View File

@@ -1719,6 +1719,12 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
// it with wxWindow stored in wxWndHook // it with wxWindow stored in wxWndHook
if ( !wnd && wxWndHook ) if ( !wnd && wxWndHook )
{ {
#if 0 // def __WXDEBUG__
char buf[512];
::GetClassNameA((HWND) hWnd, buf, 512);
wxString className(buf);
#endif
wxAssociateWinWithHandle(hWnd, wxWndHook); wxAssociateWinWithHandle(hWnd, wxWndHook);
wnd = wxWndHook; wnd = wxWndHook;
wxWndHook = NULL; wxWndHook = NULL;
@@ -2124,6 +2130,10 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd)
return (wxWindow *)node->Data(); return (wxWindow *)node->Data();
} }
#if 0 // def __WXDEBUG__
static int gs_AssociationCount = 0;
#endif
void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win) void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win)
{ {
// adding NULL hWnd is (first) surely a result of an error and // 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, wxCHECK_RET( hWnd != (HWND)NULL,
_T("attempt to add a NULL hWnd to window list ignored") ); _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); wxWinHandleList->Append((long)hWnd, win);
}
} }
void wxRemoveHandleAssociation(wxWindow *win) void wxRemoveHandleAssociation(wxWindow *win)
{ {
#if 0 // def __WXDEBUG__
if (wxWinHandleList->Member(win))
{
wxLogDebug("- Association %d", gs_AssociationCount);
gs_AssociationCount --;
}
#endif
wxWinHandleList->DeleteObject(win); wxWinHandleList->DeleteObject(win);
} }
@@ -2284,7 +2315,18 @@ bool wxWindow::MSWCreate(int id,
} }
wxWndHook = NULL; 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; return TRUE;
} }
@@ -3513,11 +3555,12 @@ void wxSetKeyboardHook(bool doIt)
{ {
wxTheKeyboardHookProc = MakeProcInstance((FARPROC) wxKeyboardHook, wxGetInstance()); wxTheKeyboardHookProc = MakeProcInstance((FARPROC) wxKeyboardHook, wxGetInstance());
wxTheKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) wxTheKeyboardHookProc, wxGetInstance(), wxTheKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) wxTheKeyboardHookProc, wxGetInstance(),
#if defined(__WIN32__) && !defined(__TWIN32__) #if defined(__WIN32__) && !defined(__TWIN32__)
GetCurrentThreadId()); GetCurrentThreadId());
// (DWORD)GetCurrentProcess()); // This is another possibility. Which is right? // (DWORD)GetCurrentProcess()); // This is another possibility. Which is right?
#else #else
GetCurrentTask()); GetCurrentTask());
#endif #endif
} }
else else