const wxEventType wxEVT_COMMAND_TREE_SEL_CHANGED = wxEVT_FIRST + 611;
const wxEventType wxEVT_COMMAND_TREE_SEL_CHANGING = wxEVT_FIRST + 612;
const wxEventType wxEVT_COMMAND_TREE_KEY_DOWN = wxEVT_FIRST + 613;
+const wxEventType wxEVT_COMMAND_TREE_ITEM_ACTIVATED = wxEVT_FIRST + 614;
/* List control event types */
const wxEventType wxEVT_COMMAND_LIST_BEGIN_DRAG = wxEVT_FIRST + 700;
const wxEventType wxEVT_COMMAND_LIST_COL_CLICK = wxEVT_FIRST + 712;
const wxEventType wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK = wxEVT_FIRST + 713;
const wxEventType wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK = wxEVT_FIRST + 714;
+const wxEventType wxEVT_COMMAND_LIST_ITEM_ACTIVATED = wxEVT_FIRST + 715;
/* Tab and notebook control event types */
const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGED = wxEVT_FIRST + 800;
#define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
#define EVT_LIST_ITEM_RIGHT_CLICK(id, fn) { wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
#define EVT_LIST_ITEM_MIDDLE_CLICK(id, fn) { wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
+#define EVT_LIST_ITEM_ACTIVATED(id, fn) { wxEVT_COMMAND_LIST_ITEM_ACTIVATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
//-----------------------------------------------------------------------------
// wxListItemData (internal)
// be deleted just after the return of this event handler (if any)
#define EVT_TREE_DELETE_ITEM(id, fn) { wxEVT_COMMAND_TREE_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
+// GetItem() returns the item that was activated (double click, enter, space)
+#define EVT_TREE_ITEM_ACTIVATED(id, fn) { wxEVT_COMMAND_TREE_ITEM_ACTIVATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
+
// -----------------------------------------------------------------------------
// wxTreeCtrl - the tree control
// -----------------------------------------------------------------------------
#define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
#define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
#define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL },
+#define EVT_LIST_ITEM_ACTIVATED(id, fn) { wxEVT_COMMAND_LIST_ITEM_ACTIVATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
#endif
// _WX_LISTCTRL_H_
// be deleted just after the return of this event handler (if any)
#define EVT_TREE_DELETE_ITEM(id, fn) { wxEVT_COMMAND_TREE_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL },
+// GetItem() returns the item that was activated (double click, enter, space)
+#define EVT_TREE_ITEM_ACTIVATED(id, fn) { wxEVT_COMMAND_TREE_ITEM_ACTIVATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, NULL },
+
#endif
// _WX_TREECTRL_H_
EVT_LIST_ITEM_SELECTED(LIST_CTRL, MyListCtrl::OnSelected)
EVT_LIST_ITEM_DESELECTED(LIST_CTRL, MyListCtrl::OnDeselected)
EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
+ EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
text->WriteText("OnDeselected\n");
}
+void MyListCtrl::OnActivated(wxListEvent& WXUNUSED(event))
+{
+ if ( !wxGetApp().GetTopWindow() )
+ return;
+
+ wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow;
+ if ( !text )
+ return;
+
+ text->WriteText("OnActivated\n");
+}
+
void MyListCtrl::OnListKeyDown(wxListEvent& WXUNUSED(event))
{
if ( !wxGetApp().GetTopWindow() )
text->WriteText("OnListKeyDown\n");
}
+
void OnSelected(wxListEvent& event);
void OnDeselected(wxListEvent& event);
void OnListKeyDown(wxListEvent& event);
+ void OnActivated(wxListEvent& event);
DECLARE_EVENT_TABLE()
};
EVT_TREE_SEL_CHANGED(TreeTest_Ctrl, MyTreeCtrl::OnSelChanged)
EVT_TREE_SEL_CHANGING(TreeTest_Ctrl, MyTreeCtrl::OnSelChanging)
EVT_TREE_KEY_DOWN(TreeTest_Ctrl, MyTreeCtrl::OnTreeKeyDown)
+ EVT_TREE_ITEM_ACTIVATED(TreeTest_Ctrl, MyTreeCtrl::OnItemActivated)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
}
void MyTreeCtrl::OnTreeKeyDown(wxTreeEvent&WXUNUSED(event))
+{
+ wxLogMessage("OnTreeKeyDown");
+}
+
+void MyTreeCtrl::OnItemActivated(wxTreeEvent&WXUNUSED(event))
{
// show some info about this item
wxTreeItemId itemId = GetSelection();
item->ShowInfo(this);
}
- wxLogMessage("OnTreeKeyDown");
+ wxLogMessage("OnItemActivated");
}
static inline const char *Bool2String(bool b)
void OnSelChanged(wxTreeEvent& event);
void OnSelChanging(wxTreeEvent& event);
void OnTreeKeyDown(wxTreeEvent& event);
+ void OnItemActivated(wxTreeEvent& event);
void GetItemsRecursively(const wxTreeItemId& idParent, long cookie);
m_lastOnSame = FALSE;
m_renameTimer->Stop();
- SendNotify( line, wxEVT_COMMAND_LIST_KEY_DOWN );
+ SendNotify( line, wxEVT_COMMAND_LIST_ITEM_ACTIVATED );
return;
}
void wxListMainWindow::OnChar( wxKeyEvent &event )
{
+ wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, m_parent->GetId() );
+ le.m_code = event.KeyCode();
+ le.SetEventObject( m_parent );
+ m_parent->GetEventHandler()->ProcessEvent( le );
+
/*
if (event.KeyCode() == WXK_TAB)
{
case WXK_RETURN:
case WXK_EXECUTE:
{
- wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
+ wxListEvent le( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, GetParent()->GetId() );
le.SetEventObject( GetParent() );
le.m_itemIndex = GetIndexOfLine( m_current );
m_current->GetItem( 0, le.m_item );
void wxTreeCtrl::OnChar( wxKeyEvent &event )
{
+ wxTreeEvent te( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
+ te.m_code = event.KeyCode();
+ te.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( te );
+
if (m_current == 0)
{
event.Skip();
case ' ':
case WXK_RETURN:
{
- wxTreeEvent event( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
+ wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
event.m_item = m_current;
event.m_code = 0;
event.SetEventObject( this );
if ( event.LeftDClick() )
{
- wxTreeEvent event( wxEVT_COMMAND_TREE_KEY_DOWN, GetId() );
+ wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
event.m_item = item;
event.m_code = 0;
event.SetEventObject( this );
}
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
+
+ if (win->GetAutoLayout()) win->Layout();
}
//-----------------------------------------------------------------------------
if (m_windowStyle & wxTE_MULTILINE)
{
- gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len );
+ gint pos = 0;
+ gtk_editable_insert_text( GTK_EDITABLE(m_text), text, len, &pos );
}
else
{
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
if (value.IsNull()) return;
- gint pos = (gint)to;
+ gint pos = (gint)from;
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos );
}
}
win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height );
+
+ if (win->GetAutoLayout()) win->Layout();
}
//-----------------------------------------------------------------------------
if (m_windowStyle & wxTE_MULTILINE)
{
- gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len );
+ gint pos = 0;
+ gtk_editable_insert_text( GTK_EDITABLE(m_text), text, len, &pos );
}
else
{
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
if (value.IsNull()) return;
- gint pos = (gint)to;
+ gint pos = (gint)from;
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos );
}