Calling a Refresh() before the window is created no longer

gives an assert. Nothing will happen.
  Added wxTreeCtrl::InsertItem( paret, before, ... ),
  Correct some places with incorrectly indented code.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5126 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-12-28 13:08:04 +00:00
parent 9b6b575004
commit f2593d0dda
18 changed files with 350 additions and 306 deletions

View File

@@ -1,12 +1,22 @@
19th December '99: wxWindows 2.1.12 released 6th January '2000: wxWindows 2.1.12 released
Who has a BigEndian computer (e.g. Sparc) that runs a 15 and/or Who has a BigEndian computer (e.g. Sparc or PowerPC) that runs a 15
16 bit colour mode? I need this for testing purposes, i.e. this and/or 16 bit colour mode? I need this for testing purposes, i.e. this
person could help me by running a small testprogram and sending person could help me by running a small testprogram and sending
me the output. me the output.
Added support for multiple font and colour support to item in Updated the 64-bit long class (a class that substitutes a 64-bit int
type on platforms which don't provide a native one).
Added wxImage::Replace() (for replacing colours) and wxImage::GetSubImage().
Also corrected conversion from mono bitmaps to wxImage.
Added wxBitmap::GetSubBitmap().
Removed some flicker from tree ctrl. Minor optical changes.
Added support for multiple font and colour support for items in
list ctrls and tree ctrls. list ctrls and tree ctrls.
Added support for multiple-selection file dialog. Added support for multiple-selection file dialog.
@@ -51,7 +61,7 @@ The ODBC classes can now be configured at run-time if they
are to use forward-only cursors or not. are to use forward-only cursors or not.
Added wxDateTime class. The existing classes wxTime and wxDate Added wxDateTime class. The existing classes wxTime and wxDate
have been reimplemented and corrected using wxDatTime. have been reimplemented and corrected using wxDateTime.
Rewritten wxThread to have a flag controlling if the Rewritten wxThread to have a flag controlling if the
thread will delete its C++ class itself ("delete this") or thread will delete its C++ class itself ("delete this") or
@@ -81,7 +91,7 @@ several such canvasses.
Some minor updates to wxSockets. Fixed timeout problem. Some minor updates to wxSockets. Fixed timeout problem.
Speed-up for new encoding related font code. Speed-up for new encoding related font code. Minor fixes.
Changed wxListBox to send deferred events, i.e. events emitted by Changed wxListBox to send deferred events, i.e. events emitted by
the listbox won't get processed before the next idle message. the listbox won't get processed before the next idle message.

View File

@@ -449,7 +449,10 @@ in {\it flags}. {\it flags} is a bitlist of the following:
\func{wxTreeItemId}{InsertItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxTreeItemId\& }{previous}, \param{const wxString\&}{ text}, \func{wxTreeItemId}{InsertItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxTreeItemId\& }{previous}, \param{const wxString\&}{ text},
\param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}}
Inserts an item after a given one. \func{wxTreeItemId}{InsertItem}{\param{const wxTreeItemId\& }{parent}, \param{size\_t}{ before}, \param{const wxString\&}{ text},
\param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}}
Inserts an item after a given one ({\it previous}) or before one identified by its position ({\it before}).
If {\it image} > -1 and {\it selImage} is -1, the same image is used for If {\it image} > -1 and {\it selImage} is -1, the same image is used for
both selected and unselected items. both selected and unselected items.

View File

@@ -337,6 +337,13 @@ public:
int image = -1, int selectedImage = -1, int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL); wxTreeItemData *data = NULL);
// insert a new item before a given one
wxTreeItemId InsertItem(const wxTreeItemId& parent,
size_t before,
const wxString& text,
int image = -1, int selectedImage = -1,
wxTreeItemData *data = NULL);
// insert a new item in as the last child of the parent // insert a new item in as the last child of the parent
wxTreeItemId AppendItem(const wxTreeItemId& parent, wxTreeItemId AppendItem(const wxTreeItemId& parent,
const wxString& text, const wxString& text,

View File

@@ -453,7 +453,8 @@ wxGenericTreeItem *wxGenericTreeItem::HitTest( const wxPoint& point,
} }
flags|=wxTREE_HITTEST_NOWHERE; flags|=wxTREE_HITTEST_NOWHERE;
return NULL;
return (wxGenericTreeItem*) NULL;
} }
int wxGenericTreeItem::GetCurrentImage() const int wxGenericTreeItem::GetCurrentImage() const
@@ -944,9 +945,26 @@ wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parentId,
int index = parent->GetChildren().Index(idPrevious.m_pItem); int index = parent->GetChildren().Index(idPrevious.m_pItem);
wxASSERT_MSG( index != wxNOT_FOUND, wxASSERT_MSG( index != wxNOT_FOUND,
wxT("previous item in wxTreeCtrl::InsertItem() is not a sibling") ); wxT("previous item in wxTreeCtrl::InsertItem() is not a sibling") );
return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data); return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data);
} }
wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parentId,
size_t before,
const wxString& text,
int image, int selImage,
wxTreeItemData *data)
{
wxGenericTreeItem *parent = parentId.m_pItem;
if ( !parent )
{
// should we give a warning here?
return AddRoot(text, image, selImage, data);
}
return DoInsertItem(parentId, before, text, image, selImage, data);
}
wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parentId, wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parentId,
const wxString& text, const wxString& text,
int image, int selImage, int image, int selImage,
@@ -1412,19 +1430,19 @@ void wxTreeCtrl::SetImageList(wxImageList *imageList)
#if 1 #if 1
wxClientDC dc(this); wxClientDC dc(this);
m_lineHeight = (int)(dc.GetCharHeight() + 4); m_lineHeight = (int)(dc.GetCharHeight() + 4);
int int width = 0, height = 0,
width = 0,
height = 0,
n = m_imageListNormal->GetImageCount(); n = m_imageListNormal->GetImageCount();
for (int i = 0; i < n ; i++) for (int i = 0; i < n ; i++)
{ {
m_imageListNormal->GetSize(i, width, height); m_imageListNormal->GetSize(i, width, height);
if (height > m_lineHeight) m_lineHeight = height; if (height > m_lineHeight) m_lineHeight = height;
} }
if (m_lineHeight<40) m_lineHeight+=2; // at least 4 pixels (odd such that a line can be drawn in between) if (m_lineHeight < 40)
else m_lineHeight+=m_lineHeight/10; // otherwise 10% extra spacing m_lineHeight += 2; // at least 2 pixels
else
m_lineHeight += m_lineHeight/10; // otherwise 10% extra spacing
#endif #endif
} }
@@ -2086,8 +2104,10 @@ void wxTreeCtrl::CalculateSize( wxGenericTreeItem *item, wxDC &dc )
int total_h = (image_h > text_h) ? image_h : text_h; int total_h = (image_h > text_h) ? image_h : text_h;
if (total_h<40) total_h+=2; // at least 4 pixels if (total_h < 40)
else total_h+=total_h/10; // otherwise 10% extra spacing total_h += 2; // at least 2 pixels
else
total_h += total_h/10; // otherwise 10% extra spacing
item->SetHeight(total_h); item->SetHeight(total_h);
if (total_h>m_lineHeight) m_lineHeight=total_h; if (total_h>m_lineHeight) m_lineHeight=total_h;

View File

@@ -152,15 +152,18 @@ wxDataObject::wxDataObject()
bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir) const bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir) const
{ {
size_t nFormatCount = GetFormatCount(dir); size_t nFormatCount = GetFormatCount(dir);
if ( nFormatCount == 1 ) { if ( nFormatCount == 1 )
{
return format == GetPreferredFormat(); return format == GetPreferredFormat();
} }
else { else
{
wxDataFormat *formats = new wxDataFormat[nFormatCount]; wxDataFormat *formats = new wxDataFormat[nFormatCount];
GetAllFormats(formats,dir); GetAllFormats(formats,dir);
size_t n; size_t n;
for ( n = 0; n < nFormatCount; n++ ) { for ( n = 0; n < nFormatCount; n++ )
{
if ( formats[n] == format ) if ( formats[n] == format )
break; break;
} }

View File

@@ -2776,8 +2776,7 @@ void wxWindow::WarpPointer( int x, int y )
void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
{ {
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (!m_widget) return;
if (!m_widget->window) return; if (!m_widget->window) return;
if (eraseBackground && m_wxwindow && m_wxwindow->window) if (eraseBackground && m_wxwindow && m_wxwindow->window)

View File

@@ -152,15 +152,18 @@ wxDataObject::wxDataObject()
bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir) const bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir) const
{ {
size_t nFormatCount = GetFormatCount(dir); size_t nFormatCount = GetFormatCount(dir);
if ( nFormatCount == 1 ) { if ( nFormatCount == 1 )
{
return format == GetPreferredFormat(); return format == GetPreferredFormat();
} }
else { else
{
wxDataFormat *formats = new wxDataFormat[nFormatCount]; wxDataFormat *formats = new wxDataFormat[nFormatCount];
GetAllFormats(formats,dir); GetAllFormats(formats,dir);
size_t n; size_t n;
for ( n = 0; n < nFormatCount; n++ ) { for ( n = 0; n < nFormatCount; n++ )
{
if ( formats[n] == format ) if ( formats[n] == format )
break; break;
} }

View File

@@ -2776,8 +2776,7 @@ void wxWindow::WarpPointer( int x, int y )
void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
{ {
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); if (!m_widget) return;
if (!m_widget->window) return; if (!m_widget->window) return;
if (eraseBackground && m_wxwindow && m_wxwindow->window) if (eraseBackground && m_wxwindow && m_wxwindow->window)