Some doc corrections (added blank lines at end of docs); corrected Forty sample

dialog behaviour; added dummy menubar constructors; corrected wxMSW wxRegion bug


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-02-12 08:22:29 +00:00
parent b98d804b28
commit cba2db0c29
29 changed files with 201 additions and 134 deletions

View File

@@ -941,7 +941,7 @@ wxPropertyValidator *wxPropertyView::FindPropertyValidator(wxProperty *property)
IMPLEMENT_DYNAMIC_CLASS(wxPropertySheet, wxObject)
wxPropertySheet::wxPropertySheet(wxString name)
wxPropertySheet::wxPropertySheet(const wxString& name)
:m_properties(wxKEY_STRING),m_name(name)
{
}
@@ -972,7 +972,7 @@ void wxPropertySheet::AddProperty(wxProperty *property)
}
// Get property by name
wxProperty *wxPropertySheet::GetProperty(wxString name)
wxProperty *wxPropertySheet::GetProperty(const wxString& name) const
{
wxNode *node = m_properties.Find((const char*) name);
if (!node)
@@ -980,7 +980,8 @@ wxProperty *wxPropertySheet::GetProperty(wxString name)
else
return (wxProperty *)node->Data();
}
bool wxPropertySheet::SetProperty(const wxString name, wxPropertyValue value)
bool wxPropertySheet::SetProperty(const wxString& name, const wxPropertyValue& value)
{
wxProperty* prop = GetProperty(name);
if(prop){
@@ -990,7 +991,8 @@ bool wxPropertySheet::SetProperty(const wxString name, wxPropertyValue value)
return FALSE;
}
}
void wxPropertySheet::RemoveProperty(wxString name)
void wxPropertySheet::RemoveProperty(const wxString& name)
{
wxNode *node = m_properties.Find(name);
if(node)
@@ -1000,10 +1002,12 @@ void wxPropertySheet::RemoveProperty(wxString name)
m_properties.DeleteNode(node);
}
}
bool wxPropertySheet::HasProperty(wxString name)
bool wxPropertySheet::HasProperty(const wxString& name) const
{
return (GetProperty(name)?TRUE:FALSE);
}
// Clear all properties
void wxPropertySheet::Clear(void)
{

View File

@@ -42,7 +42,7 @@ wxControl::~wxControl()
if (parent)
{
if (parent->GetDefaultItem() == (wxButton*) this)
parent->SetDefaultItem(NULL);
parent->SetDefaultItem((wxButton*) NULL);
}
}

View File

@@ -285,26 +285,16 @@ wxDialog::~wxDialog()
// but I think this should work, if we destroy the children first.
// Note that this might need to be done for wxFrame also.
DestroyChildren();
// This causes a crash in e.g. the resource sample when closing
// the example dialog. TODO: Probably not necessary (?)
#if 0
// Now process all events, because otherwise
// this might remain on the screen.
Display* display;
if (m_mainWidget)
display = XtDisplay((Widget) m_mainWidget);
else
display = (Display*) wxGetDisplay();
XSync(display, FALSE);
XEvent event;
while (XtAppPending((XtAppContext) wxTheApp->GetAppContext())) {
XFlush(display);
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
XtDispatchEvent(&event);
// The idea about doing it here is that if you have to remove the
// XtDestroyWidget from ~wxWindow, at least top-level windows
// will still be deleted (and destroy children implicitly).
if (GetMainWidget())
{
DetachWidget(GetMainWidget()); // Removes event handlers
XtDestroyWidget((Widget) GetMainWidget());
SetMainWidget((WXWidget) NULL);
}
#endif
}
// By default, pressing escape cancels the dialog

View File

@@ -508,6 +508,19 @@ wxMenuBar::wxMenuBar()
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
}
wxMenuBar::wxMenuBar(long WXUNUSED(style))
{
m_eventHandler = this;
m_menuCount = 0;
m_menus = NULL;
m_titles = NULL;
m_menuBarFrame = NULL;
m_mainWidget = (WXWidget) NULL;
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU);
m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT);
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
}
wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[])
{
m_eventHandler = this;

View File

@@ -235,7 +235,11 @@ wxWindow::~wxWindow()
// Destroy the window
if (GetMainWidget())
{
wxDeleteWindowFromTable((Widget) GetMainWidget());
// If this line (XtDestroyWidget) causes a crash, you may comment it out.
// Child widgets will get destroyed automatically when a frame
// or dialog is destroyed, but before that you may get some memory
// leaks and potential layout problems if you delete and then add
// child windows.
XtDestroyWidget((Widget) GetMainWidget());
SetMainWidget((WXWidget) NULL);
}

View File

@@ -92,6 +92,7 @@ COMMONOBJS = \
$(COMMDIR)\filefn.obj \
$(COMMDIR)\fileconf.obj \
$(COMMDIR)\framecmn.obj \
$(COMMDIR)\ftp.obj \
$(COMMDIR)\gdicmn.obj \
$(COMMDIR)\image.obj \
$(COMMDIR)\intl.obj \
@@ -833,6 +834,11 @@ $(COMMDIR)/framecmn.obj: $*.$(SRCSUFF)
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
<<
$(COMMDIR)/ftp.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
<<
$(COMMDIR)/gdicmn.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@

View File

@@ -562,7 +562,16 @@ bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
wxMenuBar::wxMenuBar()
{
m_eventHandler = this;
m_menuCount = 0;
m_menus = NULL;
m_titles = NULL;
m_menuBarFrame = NULL;
m_hMenu = 0;
}
wxMenuBar::wxMenuBar( long WXUNUSED(style) )
{
m_eventHandler = this;
m_menuCount = 0;
m_menus = NULL;
m_titles = NULL;

View File

@@ -351,13 +351,13 @@ void wxRegionIterator::Reset(const wxRegion& region)
m_rects = new wxRect[header->nCount];
RECT* rect = (RECT*) (rgnData + sizeof(RGNDATAHEADER)) ;
RECT* rect = (RECT*) ((char*)rgnData + sizeof(RGNDATAHEADER)) ;
size_t i;
for (i = 0; i < header->nCount; i++)
{
m_rects[i] = wxRect(rect->left, rect->top,
rect->right - rect->left, rect->bottom - rect->top);
rect += sizeof(RECT);
rect ++; // Advances pointer by sizeof(RECT)
}
m_numRects = header->nCount;