Bitmap and menu updates

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15139 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2002-04-15 03:31:42 +00:00
parent 4ca24f185f
commit 598d8cacef
10 changed files with 131 additions and 130 deletions

View File

@@ -13,11 +13,11 @@
#define _WX_MENU_H_
#if wxUSE_ACCEL
// #include "wx/accel.h"
// #include "wx/list.h" // for "template" list classes
// #include "wx/dynarray.h"
#include "wx/accel.h"
#include "wx/list.h" // for "template" list classes
#include "wx/dynarray.h"
// WX_DECLARE_EXPORTED_LIST(wxAcceleratorEntry, wxAcceleratorList);
WX_DEFINE_EXPORTED_ARRAY(wxAcceleratorEntry *, wxAcceleratorArray);
#endif // wxUSE_ACCEL
class WXDLLEXPORT wxFrame;
@@ -78,6 +78,8 @@ public:
// Implementation only from now on
// -------------------------------
//
virtual void Attach(wxMenuBarBase* pMenubar);
bool OS2Command( WXUINT uParam
,WXWORD wId
);
@@ -100,8 +102,8 @@ public:
//
// Called by wxMenuBar to build its accel table from the accels of all menus
//
bool HasAccels(void) const { return m_vAccels[0] != NULL; }
size_t GetAccelCount(void) const { return (size_t)m_nNextAccel; }
bool HasAccels(void) const { return m_vAccels.IsEmpty(); }
size_t GetAccelCount(void) const { return m_vAccels.GetCount(); }
size_t CopyAccels(wxAcceleratorEntry* pAccels) const;
//
@@ -171,8 +173,7 @@ private:
//
// The accelerators for our menu items
//
wxAcceleratorEntry* m_vAccels[128];
int m_nNextAccel;
wxAcceleratorArray m_vAccels;
#endif // wxUSE_ACCEL
DECLARE_DYNAMIC_CLASS(wxMenu)

View File

@@ -49,7 +49,7 @@ public:
,int nId = wxID_SEPARATOR
,const wxString& rStrName = ""
,const wxString& rWxHelp = ""
,wxItemKind kind = wxITEM_NORMAL
,wxItemKind eKind = wxITEM_NORMAL
,wxMenu* pSubMenu = NULL
);
@@ -88,6 +88,9 @@ public:
//
int GetRealId(void) const;
//
// Mark item as belonging to the given radio group
//
void SetAsRadioGroupStart(void);
void SetRadioGroupStart(int nStart);
void SetRadioGroupEnd(int nEnd);
@@ -111,7 +114,12 @@ private:
int m_nStart;
int m_nEnd;
} m_vRadioGroup;
//
// Does this item start a radio group?
//
bool m_bIsRadioGroupStart;
DECLARE_DYNAMIC_CLASS(wxMenuItem)
}; // end of CLASS wxMenuItem

View File

@@ -405,7 +405,7 @@ public:
,int nY
,WXUINT uFlags
);
bool HandleChar( WXDWORD wParam
bool HandleChar( WXWPARAM wParam
,WXLPARAM lParam
,bool bIsASCII = FALSE
);

View File

@@ -90,7 +90,7 @@ wxAcceleratorTable::wxAcceleratorTable(
::WinSetAccelTable( vHabmain
,hAccel
,(HWND)pFrame->GetHWND()
,(HWND)pFrame->GetFrame()
);
}
M_ACCELDATA->m_hAccel = hAccel;
@@ -162,7 +162,7 @@ wxAcceleratorTable::wxAcceleratorTable(
::WinSetAccelTable( vHabmain
,M_ACCELDATA->m_hAccel
,(HWND)pFrame->GetHWND()
,(HWND)pFrame->GetFrame()
);
}

View File

@@ -403,7 +403,7 @@ bool wxComboBox::ProcessEditMsg(
switch(vFlag)
{
case KC_CHAR:
return (HandleChar( SHORT1FROMMP(wParam)
return (HandleChar( wParam
,lParam
,TRUE /* isASCII */
));
@@ -419,6 +419,13 @@ bool wxComboBox::ProcessEditMsg(
));
}
break;
case WM_SETFOCUS:
if (SHORT1FROMMP((MPARAM)lParam) == TRUE)
return(HandleSetFocus((WXHWND)(HWND)wParam));
else
return(HandleKillFocus((WXHWND)(HWND)wParam));
break;
}
return FALSE;
} // end of WinGuiBase_CComboBox::ProcessEditMsg
@@ -440,6 +447,7 @@ MRESULT EXPENTRY wxComboEditWndProc(
//
// Forward some messages to the combobox
//
case WM_SETFOCUS:
case WM_CHAR:
{
wxComboBox* pCombo = wxDynamicCast( pWin

View File

@@ -1072,14 +1072,10 @@ bool wxFrame::HandleSize(
PositionToolBar();
#endif // wxUSE_TOOLBAR
wxSizeEvent vEvent( wxSize( nX
bProcessed = wxWindow::HandleSize( nX
,nY
)
,m_windowId
,nId
);
vEvent.SetEventObject(this);
bProcessed = GetEventHandler()->ProcessEvent(vEvent);
}
return bProcessed;
} // end of wxFrame::HandleSize

View File

@@ -113,6 +113,7 @@ static wxString TextToLabel(const wxString& rTitle)
void wxMenu::Init()
{
m_bDoBreak = FALSE;
m_nStartRadioGroup = -1;
//
// Create the menu (to be used as a submenu or a popup)
@@ -151,9 +152,6 @@ void wxMenu::Init()
);
AppendSeparator();
}
for (int i = 0; i < 128; i++)
m_vAccels[i] = NULL;
m_nNextAccel = 0;
} // end of wxMenu::Init
//
@@ -177,17 +175,7 @@ wxMenu::~wxMenu()
//
// Delete accels
//
#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
for (int i = 0; i < 128; i++)
{
if (m_vAccels[i])
{
delete m_vAccels[i];
m_vAccels[i] = NULL;
}
}
// WX_CLEAR_ARRAY(m_vAccels);
#endif
WX_CLEAR_ARRAY(m_vAccels);
#endif // wxUSE_ACCEL
} // end of wxMenu::~wxMenu
@@ -197,31 +185,26 @@ void wxMenu::Break()
m_bDoBreak = TRUE;
} // end of wxMenu::Break
#if wxUSE_ACCEL
void wxMenu::EndRadioGroup()
void wxMenu::Attach(
wxMenuBarBase* pMenubar
)
{
//
// We're not inside a radio group any longer
//
m_nStartRadioGroup = -1;
} // end of wxMenu::EndRadioGroup
wxMenuBase::Attach(pMenubar);
EndRadioGroup();
} // end of wxMenu::Break;
#if wxUSE_ACCEL
int wxMenu::FindAccel(
int nId
) const
{
size_t n;
// size_t nCount = m_vAccels.GetCount();
size_t nCount = m_vAccels.GetCount();
for (n = 0; n < m_nNextAccel; n++)
{
if (m_vAccels[n] != NULL)
{
for (n = 0; n < nCount; n++)
if (m_vAccels[n]->m_command == nId)
return n;
}
}
return wxNOT_FOUND;
} // end of wxMenu::FindAccel
@@ -246,6 +229,7 @@ void wxMenu::UpdateAccel(
// Find the (new) accel for this item
//
wxAcceleratorEntry* pAccel = wxGetAccelFromString(pItem->GetText());
if (pAccel)
pAccel->m_command = pItem->GetId();
@@ -260,17 +244,9 @@ void wxMenu::UpdateAccel(
// No old, add new if any
//
if (pAccel)
{
if (m_nNextAccel < 128)
{
m_vAccels[m_nNextAccel] = pAccel;
m_nNextAccel++;
}
m_vAccels.Add(pAccel);
else
return; // skipping RebuildAccelTable() below
}
else
return; // skipping RebuildAccelTable() below
return;
}
else
{
@@ -278,10 +254,10 @@ void wxMenu::UpdateAccel(
// Replace old with new or just remove the old one if no new
//
delete m_vAccels[n];
m_vAccels[n] = NULL;
if (pAccel)
m_vAccels[n] = pAccel;
else
m_vAccels.RemoveAt(n);
}
if (IsAttached())
@@ -437,6 +413,14 @@ bool wxMenu::DoInsertOrAppend(
return FALSE;
} // end of wxMenu::DoInsertOrAppend
void wxMenu::EndRadioGroup()
{
//
// We're not inside a radio group any longer
//
m_nStartRadioGroup = -1;
} // end of wxMenu::EndRadioGroup
bool wxMenu::DoAppend(
wxMenuItem* pItem
)
@@ -473,6 +457,7 @@ bool wxMenu::DoAppend(
// We need to update its end item
//
pItem->SetRadioGroupStart(m_nStartRadioGroup);
wxMenuItemList::Node* pNode = GetMenuItems().Item(m_nStartRadioGroup);
if (pNode)
@@ -489,16 +474,20 @@ bool wxMenu::DoAppend(
{
EndRadioGroup();
}
if (!wxMenuBase::DoAppend(pItem) || !DoInsertOrAppend(pItem))
{
return FALSE;
}
if (bCheck)
{
//
// Check the item initially
//
pItem->Check(TRUE);
}
return TRUE;
} // end of wxMenu::DoInsert
} // end of wxMenu::DoAppend
bool wxMenu::DoInsert(
size_t nPos
@@ -509,7 +498,8 @@ bool wxMenu::DoInsert(
,pItem) &&
DoInsertOrAppend( pItem
,nPos
));
)
);
} // end of wxMenu::DoInsert
wxMenuItem* wxMenu::DoRemove(
@@ -543,7 +533,7 @@ wxMenuItem* wxMenu::DoRemove(
if (n != wxNOT_FOUND)
{
delete m_vAccels[n];
m_vAccels[n] = NULL;
m_vAccels.RemoveAt(n);
}
#endif // wxUSE_ACCEL
@@ -1120,7 +1110,7 @@ void wxMenuBar::Attach(
wxFrame* pFrame
)
{
wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
wxMenuBarBase::Attach(pFrame);
#if wxUSE_ACCEL
RebuildAccelTable();
@@ -1128,8 +1118,8 @@ void wxMenuBar::Attach(
// Ensure the accelerator table is set to the frame (not the client!)
//
if (!::WinSetAccelTable( vHabmain
,(HWND)pFrame->GetHWND()
,m_vAccelTable.GetHACCEL()
,(HWND)pFrame->GetFrame()
))
wxLogLastError("WinSetAccelTable");
#endif // wxUSE_ACCEL

View File

@@ -236,9 +236,10 @@ wxString wxMenuItemBase::GetLabelFromText(
return label;
}
// radio group stuff
//
// Radio group stuff
// -----------------
//
void wxMenuItem::SetAsRadioGroupStart()
{
m_bIsRadioGroupStart = TRUE;
@@ -248,23 +249,23 @@ void wxMenuItem::SetRadioGroupStart(
int nStart
)
{
wxASSERT_MSG( !m_bIsRadioGroupStart,
_T("should only be called for the next radio items") );
wxASSERT_MSG( !m_bIsRadioGroupStart
,_T("should only be called for the next radio items")
);
m_vRadioGroup.m_nStart = nStart;
} // end of wxMenuItem::SetRadioGroupStart
} // wxMenuItem::SetRadioGroupStart
void wxMenuItem::SetRadioGroupEnd(
int nEnd
)
{
wxASSERT_MSG( m_bIsRadioGroupStart,
_T("should only be called for the first radio item") );
wxASSERT_MSG( m_bIsRadioGroupStart
,_T("should only be called for the first radio item")
);
m_vRadioGroup.m_nEnd = nEnd;
} // end of wxMenuItem::SetRadioGroupEnd
// change item state
// -----------------
@@ -306,6 +307,7 @@ void wxMenuItem::Check(
return;
HMENU hMenu = GetHmenuOf(m_parentMenu);
if (GetKind() == wxITEM_RADIO)
{
//
@@ -319,23 +321,26 @@ void wxMenuItem::Check(
//
const wxMenuItemList& rItems = m_parentMenu->GetMenuItems();
int nPos = rItems.IndexOf(this);
int nStart;
int nEnd;
wxCHECK_RET( nPos != wxNOT_FOUND,
_T("menuitem not found in the menu items list?") );
wxCHECK_RET( nPos != wxNOT_FOUND
,_T("menuitem not found in the menu items list?")
);
//
// Get the radio group range
//
int nStart;
int nEnd;
if (m_bIsRadioGroupStart)
{
// we already have all information we need
//
// We already have all information we need
//
nStart = nPos;
nEnd = m_vRadioGroup.m_nEnd;
}
else // Next radio group item
else // next radio group item
{
//
// Get the radio group end from the start item
@@ -351,22 +356,18 @@ void wxMenuItem::Check(
for (int n = nStart; n <= nEnd && pNode; n++)
{
if (n != nPos)
{
pNode->GetData()->m_isChecked = FALSE;
}
if (n == nPos)
{
bOk = (bool)::WinSendMsg( hMenu
::WinSendMsg( hMenu
,MM_SETITEMATTR
,MPFROM2SHORT(n, TRUE)
,MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED)
);
}
else
if (n != nPos)
{
bOk = (bool)::WinSendMsg( hMenu
pNode->GetData()->m_isChecked = FALSE;
::WinSendMsg( hMenu
,MM_SETITEMATTR
,MPFROM2SHORT(n, TRUE)
,MPFROM2SHORT(MIA_CHECKED, FALSE)

View File

@@ -2759,20 +2759,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
break;
default:
if (m_bLastKeydownProcessed)
{
//
// The key was handled in the EVT_KEY_DOWN and handling
// a key in an EVT_KEY_DOWN handler is meant, by
// design, to prevent EVT_CHARs from happening
//
m_bLastKeydownProcessed = FALSE;
bProcessed = TRUE;
}
else // do generate a CHAR event
{
bProcessed = HandleChar((WXDWORD)wParam, lParam);
}
bProcessed = HandleChar(wParam, lParam);
}
break;
}
@@ -2790,7 +2777,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
}
else // do generate a CHAR event
{
bProcessed = HandleChar((WXDWORD)wParam, lParam, TRUE);
bProcessed = HandleChar(wParam, lParam, TRUE);
break;
}
}
@@ -4050,7 +4037,7 @@ wxKeyEvent wxWindowOS2::CreateKeyEvent(
// WM_KEYDOWN one
//
bool wxWindowOS2::HandleChar(
WXDWORD wParam
WXWPARAM wParam
, WXLPARAM lParam
, bool isASCII
)
@@ -4073,7 +4060,7 @@ bool wxWindowOS2::HandleChar(
//
// If 1 -> 26, translate to CTRL plus a letter.
//
vId = wParam;
vId = (int)wParam;
if ((vId > 0) && (vId < 27))
{
switch (vId)
@@ -4098,7 +4085,7 @@ bool wxWindowOS2::HandleChar(
}
else // we're called from WM_KEYDOWN
{
vId = wxCharCodeOS2ToWX(wParam);
vId = wxCharCodeOS2ToWX((int)wParam);
if (vId == 0)
return FALSE;
}

View File

@@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
CODE LOADONCALL
EXPORTS
;From library: H:\DEV\Wx2\WxWindows\lib\wx.lib
;From library: F:\DEV\WX2\WXWINDOWS\LIB\WX.lib
;From object file: dummy.cpp
;PUBDEFs (Symbols available from object file):
wxDummyChar
@@ -1709,6 +1709,8 @@ EXPORTS
wxConstructorForwxSysColourChangedEvent__Fv
;wxConstructorForwxNavigationKeyEvent()
wxConstructorForwxNavigationKeyEvent__Fv
;wxConstructorForwxMouseCaptureChangedEvent()
wxConstructorForwxMouseCaptureChangedEvent__Fv
;wxConstructorForwxHelpEvent()
wxConstructorForwxHelpEvent__Fv
;wxEvtHandler::~wxEvtHandler()
@@ -1879,6 +1881,8 @@ EXPORTS
sm_classwxScrollWinEvent__16wxScrollWinEvent
;wxNcPaintEvent::sm_classwxNcPaintEvent
sm_classwxNcPaintEvent__14wxNcPaintEvent
;wxMouseCaptureChangedEvent::sm_classwxMouseCaptureChangedEvent
sm_classwxMouseCaptureChangedEvent__26wxMouseCaptureChangedEvent
;wxIdleEvent::sm_classwxIdleEvent
sm_classwxIdleEvent__11wxIdleEvent
;wxDropFilesEvent::sm_classwxDropFilesEvent
@@ -1921,7 +1925,7 @@ EXPORTS
wxEVT_NC_LEFT_DCLICK
wxEVT_INIT_DIALOG
wxEVT_COMMAND_SET_FOCUS
;From object file: H:\DEV\WX2\WXWINDOWS\src\common\extended.c
;From object file: F:\DEV\WX2\WXWINDOWS\src\common\extended.c
;PUBDEFs (Symbols available from object file):
ConvertToIeeeExtended
ConvertFromIeeeExtended
@@ -6023,7 +6027,7 @@ EXPORTS
Read32__17wxTextInputStreamFv
;wxTextInputStream::SkipIfEndOfLine(char)
SkipIfEndOfLine__17wxTextInputStreamFc
;From object file: H:\DEV\WX2\WXWINDOWS\src\common\unzip.c
;From object file: F:\DEV\WX2\WXWINDOWS\src\common\unzip.c
;PUBDEFs (Symbols available from object file):
unzReadCurrentFile
unzGetCurrentFileInfo
@@ -7706,12 +7710,16 @@ EXPORTS
SetFilterIndex__16wxGenericDirCtrlFi
;wxDirFilterListCtrl::FillFilterList(const wxString&,int)
FillFilterList__19wxDirFilterListCtrlFRC8wxStringi
;wxGenericDirCtrl::ReCreateTree()
ReCreateTree__16wxGenericDirCtrlFv
;wxGenericDirCtrl::SetupSections()
SetupSections__16wxGenericDirCtrlFv
;wxGenericDirCtrl::ShowHidden(unsigned long)
ShowHidden__16wxGenericDirCtrlFUl
;wxGenericDirCtrl::OnCollapseItem(wxTreeEvent&)
OnCollapseItem__16wxGenericDirCtrlFR11wxTreeEvent
;wxGenericDirCtrl::CollapseDir(wxTreeItemId)
CollapseDir__16wxGenericDirCtrlF12wxTreeItemId
;wxDirItemData::HasSubDirs() const
HasSubDirs__13wxDirItemDataCFv
;wxGenericDirCtrl::GetPath() const
@@ -13246,10 +13254,12 @@ EXPORTS
OS2Command__6wxMenuFUiUs
;wxMenuBar::EnableTop(unsigned int,unsigned long)
EnableTop__9wxMenuBarFUiUl
;wxMenu::DoAppend(wxMenuItem*)
DoAppend__6wxMenuFP10wxMenuItem
;wxMenu::Attach(wxMenuBarBase*)
Attach__6wxMenuFP13wxMenuBarBase
;wxMenu::DoRemove(wxMenuItem*)
DoRemove__6wxMenuFP10wxMenuItem
;wxMenu::DoAppend(wxMenuItem*)
DoAppend__6wxMenuFP10wxMenuItem
;wxMenu::CopyAccels(wxAcceleratorEntry*) const
CopyAccels__6wxMenuCFP18wxAcceleratorEntry
;wxMenuBar::Refresh()
@@ -14977,8 +14987,8 @@ EXPORTS
FindItemByHWND__8wxWindowCFUlT1
;wxWindow::HandleKeyUp(void*,void*)
HandleKeyUp__8wxWindowFPvT1
;wxWindow::HandleChar(unsigned long,void*,unsigned long)
HandleChar__8wxWindowFUlPvT1
;wxWindow::HandleChar(void*,void*,unsigned long)
HandleChar__8wxWindowFPvT1Ul
;wxWindow::DoMoveWindow(int,int,int,int)
DoMoveWindow__8wxWindowFiN31
;wxWindow::DoClientToScreen(int*,int*) const