some mingw32 warnings fixed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7670 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-07-03 07:12:20 +00:00
parent 792a17440e
commit 3dd8eab441
3 changed files with 36 additions and 55 deletions

View File

@@ -225,8 +225,10 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
WXHWND wxComboBox::GetEditHWND() const WXHWND wxComboBox::GetEditHWND() const
{ {
if ( GetWindowStyle() & wxCB_READONLY ) // this function should not be called for wxCB_READONLY controls, it is
return NULL; // the callers responsability to check this
wxASSERT_MSG( !(GetWindowStyle() & wxCB_READONLY),
_T("read-only combobox doesn't have any edit control") );
POINT pt; POINT pt;
pt.x = pt.y = 4; pt.x = pt.y = 4;

View File

@@ -417,39 +417,40 @@ void wxFrame::PositionStatusBar()
void wxFrame::DetachMenuBar() void wxFrame::DetachMenuBar()
{ {
if (m_frameMenuBar) if ( m_frameMenuBar )
{ {
m_frameMenuBar->Detach(); m_frameMenuBar->Detach();
m_frameMenuBar = NULL; m_frameMenuBar = NULL;
} }
} }
void wxFrame::SetMenuBar(wxMenuBar *menu_bar) void wxFrame::SetMenuBar(wxMenuBar *menubar)
{ {
if (!menu_bar) if ( !menubar )
{ {
DetachMenuBar(); DetachMenuBar();
//actually remove the menu from the frame
m_hMenu=NULL;
InternalSetMenuBar();
return;
}
// actually remove the menu from the frame
m_hMenu = (WXHMENU)0;
InternalSetMenuBar();
}
else // set new non NULL menu bar
{
m_frameMenuBar = NULL; m_frameMenuBar = NULL;
// Can set a menubar several times. // Can set a menubar several times.
// TODO: how to prevent a memory leak if you have a currently-unattached // TODO: how to prevent a memory leak if you have a currently-unattached
// menubar? wxWindows assumes that the frame will delete the menu (otherwise // menubar? wxWindows assumes that the frame will delete the menu (otherwise
// there are problems for MDI). // there are problems for MDI).
if (menu_bar->GetHMenu()) if ( menubar->GetHMenu() )
{ {
m_hMenu = menu_bar->GetHMenu(); m_hMenu = menubar->GetHMenu();
} }
else else
{ {
menu_bar->Detach(); menubar->Detach();
m_hMenu = menu_bar->Create(); m_hMenu = menubar->Create();
if ( !m_hMenu ) if ( !m_hMenu )
return; return;
@@ -457,31 +458,9 @@ void wxFrame::SetMenuBar(wxMenuBar *menu_bar)
InternalSetMenuBar(); InternalSetMenuBar();
m_frameMenuBar = menu_bar; m_frameMenuBar = menubar;
menu_bar->Attach(this); menubar->Attach(this);
#if 0 // Old code that assumes only one call of SetMenuBar per frame.
if (!menu_bar)
{
DetachMenuBar();
return;
} }
wxCHECK_RET( !menu_bar->GetFrame(), wxT("this menubar is already attached") );
if (m_frameMenuBar)
delete m_frameMenuBar;
m_hMenu = menu_bar->Create();
if ( !m_hMenu )
return;
InternalSetMenuBar();
m_frameMenuBar = menu_bar;
menu_bar->Attach(this);
#endif
} }
void wxFrame::InternalSetMenuBar() void wxFrame::InternalSetMenuBar()

View File

@@ -2195,7 +2195,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
if ( tvhti.flags & TVHT_ONITEM ) if ( tvhti.flags & TVHT_ONITEM )
{ {
event.m_item = (WXHTREEITEM) tvhti.hItem; event.m_item = (WXHTREEITEM) tvhti.hItem;
eventType = hdr->code == NM_DBLCLK eventType = (int)hdr->code == NM_DBLCLK
? wxEVT_COMMAND_TREE_ITEM_ACTIVATED ? wxEVT_COMMAND_TREE_ITEM_ACTIVATED
: wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK; : wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK;
} }