wxWindows/GTK requires the GTK+ library to be installed on your system.
It has to be a stable version, preferebly version 1.0.6. When using
-a version previous to 1.0.6 you'll get crashes here and there. Although
-wxWindows/GTK now compiles with GTK+ 1.1.3, it does not set work
-properly. Wait for a stable version GTK 1.2.
+a version previous to 1.0.6 you'll get crashes here and there.
+
+wxWindows/GTK does NOT work with the 1.1.X versions of the GTK+ library
+and we will wait until the 1.2 version comes out and has stabilized
+until we'll work with that library.
You can get the newest version of the GTK+ from the GTK homepage
at
Welcome to wxWindows/Gtk,
-you have downloaded version 1.97 of the GTK+ port of C++ library
+you have downloaded version 1.99 of the GTK+ port of C++ library
wxWindows. Information on how to install can be found in the
file INSTALL.txt, but if you cannot wait, this should work on
all systems
DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know
this has no effect, but I tried...
-wxWindows/Gtk is still in development and you can have a look
-at the TODO.txt to see what's missing before an official beta
-and - more important - before we can aim at binary compatibility.
+This is the beta release which means that we have a feature
+freeze. We'll move up to versin 2.0 rather soon and from then
+on there will be no more binary incompatible changes. We might
+add more classes, but none that would alter the behaviour of
+the existing ones. The library produced by the install process
+of the final version will be called libwx_gtk_1_0.a (static)
+and libwx_gtk_1_0.so.2.0.0 (shared) so that once a version
+of wxWindows/Gtk for GTK 1.2 comes out we'll change the name
+of the library to avoid linking problems.
More information is available from my homepage at
the wxWindows developers list. Information on how to subscribe
is available from my homepage.
-wxWindows/Gtk comes with no guarantee whatsoever. It might crash
-your harddisk or destroy your monitor. It doesn't claim to be
+wxWindows/Gtk doesn't come with any guarantee whatsoever. It might
+crash your harddisk or destroy your monitor. It doesn't claim to be
suitable for any special purpose.
Regards,
-------------------- High priority ---------------------
-wxTreeCtrl
- -> Keyboard handling.
-
wxClipboard
-> On the way, but not functional yet.
-Fix printing of bitmaps
- -> No idea.
-
-------------------- Low priority ---------------------
OwnerDraw for wxListCtrl and others
wxTreeItemId(long itemId) { m_pItem = (wxGenericTreeItem *)itemId; }
operator long() const { return (long)m_pItem; }
-//protected:
+//protected: // not for gcc
// for wxTreeCtrl usage only
wxTreeItemId(wxGenericTreeItem *pItem) { m_pItem = pItem; }
// is the item visible (it might be outside the view or not expanded)?
bool IsVisible(const wxTreeItemId& item) const;
// does the item has any children?
+ bool HasChildren(const wxTreeItemId& item) const
+ { return ItemHasChildren(item); }
bool ItemHasChildren(const wxTreeItemId& item) const;
// is the item expanded (only makes sense if HasChildren())?
bool IsExpanded(const wxTreeItemId& item) const;
EVT_TREE_ITEM_COLLAPSING(TreeTest_Ctrl, MyTreeCtrl::OnItemCollapsing)
EVT_TREE_SEL_CHANGED(TreeTest_Ctrl, MyTreeCtrl::OnSelChanged)
EVT_TREE_SEL_CHANGING(TreeTest_Ctrl, MyTreeCtrl::OnSelChanging)
- EVT_CHAR(MyTreeCtrl::OnKeyDown)
+ EVT_TREE_KEY_DOWN(TreeTest_Ctrl, MyTreeCtrl::OnTreeKeyDown)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
}
}
-void MyTreeCtrl::OnKeyDown(wxTreeEvent& WXUNUSED(event))
+void MyTreeCtrl::OnTreeKeyDown(wxTreeEvent&WXUNUSED(event))
{
// show some info about this item
wxTreeItemId itemId = GetSelection();
item->ShowInfo(this);
}
- wxLogMessage("OnKeyDown");
+ wxLogMessage("OnTreeKeyDown");
}
static inline const char *Bool2String(bool b)
return b ? "" : "not ";
}
-void MyTreeItemData::ShowInfo(wxTreeCtrl *tree)
+void MyTreeItemData::ShowInfo(wxTreeCtrl */*tree*/)
{
/*
wxLogMessage("Item '%s': %sselected, %sexpanded, %sbold,\n"
void OnItemCollapsing(wxTreeEvent& event);
void OnSelChanged(wxTreeEvent& event);
void OnSelChanging(wxTreeEvent& event);
- void OnKeyDown(wxTreeEvent& event);
+ void OnTreeKeyDown(wxTreeEvent& event);
void GetItemsRecursively(const wxTreeItemId& idParent, long cookie);
void OnDeleteAll(wxCommandEvent& event);
void OnRecreate(wxCommandEvent& event);
- void OnSetBold(wxCommandEvent& event) { DoSetBold(TRUE); }
- void OnClearBold(wxCommandEvent& event) { DoSetBold(FALSE); }
+ void OnSetBold(wxCommandEvent& WXUNUSED(event)) { DoSetBold(TRUE); }
+ void OnClearBold(wxCommandEvent& WXUNUSED(event)) { DoSetBold(FALSE); }
private:
MyTreeCtrl *m_treeCtrl;
event.m_item = item;
event.m_itemOld = m_current;
event.SetEventObject( this );
- if ( ProcessEvent( event ) && event.WasVetoed() )
+ if ( GetEventHandler()->ProcessEvent( event ) && event.WasVetoed() )
return;
if ( m_current )
RefreshLine( m_current );
event.SetEventType(wxEVT_COMMAND_TREE_SEL_CHANGED);
- ProcessEvent( event );
+ GetEventHandler()->ProcessEvent( event );
}
}
-void wxTreeCtrl::EnsureVisible(const wxTreeItemId& WXUNUSED(item))
+void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item)
{
- wxFAIL_MSG("not implemented");
+ wxGenericTreeItem *gitem = item.m_pItem;
+
+ int item_y = gitem->GetY();
+
+ int start_x = 0;
+ int start_y = 0;
+ ViewStart( &start_x, &start_y );
+ start_y *= 10;
+
+ if (item_y < start_y+3)
+ {
+ int x = 0;
+ int y = 0;
+ m_anchor->GetSize( x, y );
+ y += 2*m_lineHeight;
+ int x_pos = GetScrollPos( wxHORIZONTAL );
+ SetScrollbars( 10, 10, x/10, y/10, x_pos, item_y/10 );
+ return;
+ }
+
+ int w = 0;
+ int h = 0;
+ GetClientSize( &w, &h );
+
+ if (item_y > start_y+h-26)
+ {
+ int x = 0;
+ int y = 0;
+ m_anchor->GetSize( x, y );
+ y += 2*m_lineHeight;
+ int x_pos = GetScrollPos( wxHORIZONTAL );
+ SetScrollbars( 10, 10, x/10, y/10, x_pos, (item_y-h+30)/10 );
+ return;
+ }
}
void wxTreeCtrl::ScrollTo(const wxTreeItemId& WXUNUSED(item))
void wxTreeCtrl::OnChar( wxKeyEvent &event )
{
- // TODO process '+', '-' (expand/collapse branch) and cursor keys
+ if (m_current == 0)
+ {
+ event.Skip();
+ return;
+ }
+
+ switch (event.KeyCode())
+ {
+ case '+':
+ case WXK_ADD:
+ {
+ if (HasChildren(m_current) && !IsExpanded(m_current))
+ {
+ Expand(m_current);
+ }
+ return;
+ }
+ case '-':
+ case WXK_SUBTRACT:
+ {
+ if (IsExpanded(m_current))
+ {
+ Collapse(m_current);
+ }
+ return;
+ }
+ case ' ':
+ case WXK_RETURN:
+ {
+ wxTreeEvent event( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
+ event.m_item = m_current;
+ event.m_code = 0;
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( event );
+ return;
+ }
+ case WXK_UP:
+ {
+ wxTreeItemId prev = GetPrevSibling( m_current );
+ if (prev != 0)
+ {
+ SelectItem( prev );
+ EnsureVisible( prev );
+ }
+ else
+ {
+ prev = GetParent( m_current );
+ if (prev)
+ {
+ EnsureVisible( prev );
+ SelectItem( prev );
+ }
+ }
+ return;
+ }
+ case WXK_DOWN:
+ {
+ if (IsExpanded(m_current))
+ {
+ long cookie = 0;
+ wxTreeItemId child = GetFirstChild( m_current, cookie );
+ SelectItem( child );
+ EnsureVisible( child );
+ }
+ else
+ {
+ wxTreeItemId next = GetNextSibling( m_current );
+ if (next == 0)
+ {
+ wxTreeItemId current = m_current;
+ while (current && !next)
+ {
+ current = GetParent( current );
+ if (current) next = GetNextSibling( current );
+ }
+ }
+ if (next != 0)
+ {
+ SelectItem( next );
+ EnsureVisible( next );
+ }
+ }
+ return;
+ }
+ }
event.Skip();
}
if ( item == NULL )
return;
- SelectItem(item);
+ if (!IsSelected(item)) SelectItem(item);
if ( event.LeftDClick() )
{
event.m_item = item;
event.m_code = 0;
event.SetEventObject( this );
- ProcessEvent( event );
+ GetEventHandler()->ProcessEvent( event );
}
if ( onButton )