本文整理汇总了C++中wxTreeEvent::Veto方法的典型用法代码示例。如果您正苦于以下问题:C++ wxTreeEvent::Veto方法的具体用法?C++ wxTreeEvent::Veto怎么用?C++ wxTreeEvent::Veto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxTreeEvent
的用法示例。
在下文中一共展示了wxTreeEvent::Veto方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBeginLabelEdit
void CLocalTreeView::OnBeginLabelEdit(wxTreeEvent& event)
{
wxTreeItemId item = event.GetItem();
#ifdef __WXMSW__
if (item == m_desktop || item == m_documents)
{
wxBell();
event.Veto();
return;
}
#endif
wxString path = GetDirFromItem(item);
#ifdef __WXMSW__
if (path.Len() == 3 && path.Mid(1) == _T(":\\"))
{
wxBell();
event.Veto();
return;
}
#endif
if (!m_pState->LocalDirHasParent(path) || !m_pState->LocalDirIsWriteable(path))
{
wxBell();
event.Veto();
return;
}
}
示例2: OnBeginLabelEdit
void wxGxTreeView::OnBeginLabelEdit(wxTreeEvent& event)
{
wxTreeItemId item = event.GetItem();
if(!item.IsOk())
return;
wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(item);
if(pData == NULL)
{
event.Veto();
return;
}
wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(pData->m_nObjectID);
IGxObjectEdit* pObjEdit = dynamic_cast<IGxObjectEdit*>(pGxObject);
IGxObjectTreeAttr* pObjAttr = dynamic_cast<IGxObjectTreeAttr*>(pGxObject);
if(pObjEdit == NULL || pObjAttr)
{
event.Veto();
return;
}
if(!pObjEdit->CanRename())
{
event.Veto();
return;
}
}
示例3: OnBeginDrag
//----------------------------------------
void CFieldsTreeCtrl::OnBeginDrag( wxTreeEvent &event )
{
if (ItemHasChildren(event.GetItem()))
{
event.Veto();
return;
}
CFieldsTreeItemData* itemData = dynamic_cast<CFieldsTreeItemData*>(GetItemData(event.GetItem()));
if (itemData == NULL)
{
event.Veto();
return;
}
CField* field = itemData->GetField();
if (field == NULL)
{
event.Veto();
return;
}
//event.Allow();
// start drag operation
CDndField* dndField = new CDndField();
// dndField->AddField(field);
dndField->m_field = field;
CDndFieldDataObject dndFieldDataObject(dndField);
wxDropSource source(dndFieldDataObject, this, wxDROP_ICON(dnd_copy),
wxDROP_ICON(dnd_move), wxDROP_ICON(dnd_none));
//source.DoDragDrop(wxDrag_DefaultMove); // Effectuer l'opération de D&D
source.DoDragDrop(); // Effectuer l'opération de D&D
event.Skip();
/*
wxDropSource source(textData, this,
wxDROP_ICON(dnd_copy),
wxDROP_ICON(dnd_move),
wxDROP_ICON(dnd_none));
*/
/*
wxDropSource source(textData, this);
//int flags = 0;
wxDragResult result = source.DoDragDrop();
*/
}
示例4: OnBeginLabelEdit
void CBookmarksDialog::OnBeginLabelEdit(wxTreeEvent& event)
{
wxTreeItemId item = event.GetItem();
if (item != m_pTree->GetSelection()) {
if (!Verify()) {
event.Veto();
return;
}
}
if (!item || item == m_bookmarks_global || item == m_bookmarks_site) {
event.Veto();
return;
}
}
示例5: OnEndLabelEdit
///////////////////////////////////////////////////////////////////////////////
// GUI callback for when a label is done being edited by the user. Creates a
// command to change the name of the dependency node associated with the item.
//
void SceneOutliner::OnEndLabelEdit( wxTreeEvent& args )
{
if ( !args.IsEditCancelled() )
{
SceneOutlinerItemData* data = GetTreeItemData( args.GetItem() );
Reflect::Object* object = data->GetObject();
SceneGraph::SceneNode* node = Reflect::SafeCast< SceneGraph::SceneNode >( object );
if ( node )
{
const tstring newName = args.GetLabel().c_str();
if ( node->GetName() != newName )
{
// Create an undoable command to rename the object
m_CurrentScene->Push( new PropertyUndoCommand<tstring>( new Helium::MemberProperty<SceneGraph::SceneNode, tstring> (node, &SceneGraph::SceneNode::GetName, &SceneGraph::SceneNode::SetGivenName), newName) );
m_CurrentScene->Execute( false );
// Sort
Sort( m_TreeCtrl->GetItemParent( args.GetItem() ) );
// Keep the item in view
if ( !m_TreeCtrl->IsVisible( args.GetItem() ) )
{
m_TreeCtrl->EnsureVisible( args.GetItem() );
}
}
args.Veto();
OnSelectionChanged( (wxTreeEvent)NULL );
}
}
}
示例6: OnItemActivated
void wxGenericDirCtrl::OnItemActivated(wxTreeEvent &event)
{
wxTreeItemId treeid = event.GetItem();
const wxDirItemData *data = GetItemData(treeid);
if (data->m_isDir)
{
// is dir
event.Skip();
}
else
{
// is file
wxTreeEvent changedEvent(wxEVT_DIRCTRL_FILEACTIVATED, GetId());
changedEvent.SetEventObject(this);
changedEvent.SetItem(treeid);
changedEvent.SetClientObject(m_treeCtrl->GetItemData(treeid));
if (GetEventHandler()->SafelyProcessEvent(changedEvent) && !changedEvent.IsAllowed())
event.Veto();
else
event.Skip();
}
}
示例7: OnBeginEditItem
void wxGenericDirCtrl::OnBeginEditItem(wxTreeEvent &event)
{
// don't rename the main entry "Sections"
if (event.GetItem() == m_rootId)
{
event.Veto();
return;
}
// don't rename the individual sections
if (m_treeCtrl->GetItemParent( event.GetItem() ) == m_rootId)
{
event.Veto();
return;
}
}
示例8: OnTreeItemCollapsing
void ProjectExplorerWindow::OnTreeItemCollapsing(wxTreeEvent& event)
{
if (event.GetItem() == m_stopExpansion)
{
event.Veto();
m_stopExpansion = 0;
}
}
示例9: OnEndEditItem
void wxGenericDirCtrl::OnEndEditItem(wxTreeEvent &event)
{
if (event.IsEditCancelled())
return;
if ((event.GetLabel().empty()) ||
(event.GetLabel() == wxT(".")) ||
(event.GetLabel() == wxT("..")) ||
(event.GetLabel().Find(wxT('/')) != wxNOT_FOUND) ||
(event.GetLabel().Find(wxT('\\')) != wxNOT_FOUND) ||
(event.GetLabel().Find(wxT('|')) != wxNOT_FOUND))
{
wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR );
dialog.ShowModal();
event.Veto();
return;
}
wxTreeItemId treeid = event.GetItem();
wxDirItemData *data = (wxDirItemData*)m_treeCtrl->GetItemData( treeid );
wxASSERT( data );
wxString new_name( wxPathOnly( data->m_path ) );
new_name += wxString(wxFILE_SEP_PATH);
new_name += event.GetLabel();
wxLogNull log;
if (wxFileExists(new_name))
{
wxMessageDialog dialog(this, _("File name exists already."), _("Error"), wxOK | wxICON_ERROR );
dialog.ShowModal();
event.Veto();
}
if (wxRenameFile(data->m_path,new_name))
{
data->SetNewDirName( new_name );
}
else
{
wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
dialog.ShowModal();
event.Veto();
}
}
示例10: OnPageChanging
void CSettingsDialog::OnPageChanging(wxTreeEvent& event)
{
if (!m_activePanel)
return;
if (!m_activePanel->Validate())
event.Veto();
}
示例11: OnBeginLabelEdit
void SceneBrowser::OnBeginLabelEdit(wxTreeEvent& event)
{
wxTreeItemId item = event.GetItem();
wxASSERT(item.IsOk());
ObjectItemData* data = static_cast<ObjectItemData*>(mObjectsTree->GetItemData(item));
if (!data || data->object.expired())
event.Veto();
}
示例12: onTreeEndDrag
void BookmarkView::onTreeEndDrag( wxTreeEvent& event ) {
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
wxColour textColor(ThemeMgr::mgr.currentTheme->text);
m_treeView->SetBackgroundColour(bgColor);
m_treeView->SetForegroundColour(textColor);
m_treeView->UnsetToolTip();
SetCursor(wxCURSOR_ARROW);
if (visualDragItem != nullptr) {
visualDragItem->Destroy();
delete visualDragItem;
visualDragItem = nullptr;
}
if (!event.GetItem()) {
event.Veto();
return;
}
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(event.GetItem()));
if (!tvi) {
if (event.GetItem() == bookmarkBranch) {
if (dragItem && dragItem->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
doBookmarkActive(BOOKMARK_VIEW_STR_UNNAMED, dragItem->demod);
} else if (dragItem && dragItem->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) {
doBookmarkRecent(BOOKMARK_VIEW_STR_UNNAMED, dragItem->bookmarkEnt);
} else if (dragItem && dragItem->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
doMoveBookmark(dragItem->bookmarkEnt, BOOKMARK_VIEW_STR_UNNAMED);
}
}
return;
}
if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
if (dragItem && dragItem->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { // Active -> Group Item
doBookmarkActive(tvi->groupName, dragItem->demod);
} else if (dragItem && dragItem->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) { // Recent -> Group Item
doBookmarkRecent(tvi->groupName, dragItem->bookmarkEnt);
m_treeView->Delete(dragItemId);
} else if (dragItem && dragItem->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) { // Bookmark -> Group Item
doMoveBookmark(dragItem->bookmarkEnt, tvi->groupName);
}
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
if (dragItem && dragItem->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { // Active -> Same Group
doBookmarkActive(tvi->groupName, dragItem->demod);
} else if (dragItem && dragItem->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) { // Recent -> Same Group
doBookmarkRecent(tvi->groupName, dragItem->bookmarkEnt);
m_treeView->Delete(dragItemId);
} else if (dragItem && dragItem->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) { // Bookmark -> Same Group
doMoveBookmark(dragItem->bookmarkEnt, tvi->groupName);
}
}
}
示例13: OnGetToolTip
//----------------------------------------
void CFieldsTreeCtrl::OnGetToolTip( wxTreeEvent &event )
{
if (m_product == NULL)
{
event.Veto();
return;
}
wxTreeItemId itemId = event.GetItem();
CFieldsTreeItemData* itemData = itemId.IsOk() ? dynamic_cast<CFieldsTreeItemData*>(GetItemData(itemId))
: NULL;
if (itemData == NULL)
{
event.Veto();
return;
}
CField* field = itemData->GetField();
if (field == NULL)
{
event.Veto();
return;
}
/*
wxString str;
wxStringTokenizer tkz(wxT(field->GetDescription()), wxT("."), wxTOKEN_RET_DELIMS);
while ( tkz.HasMoreTokens() ){
str.Append(tkz.GetNextToken());
if (tkz.HasMoreTokens())
{
str.Append("\n");
}
}
*/
SetToolTip(NULL); // This forces to recreate tooltip and to set its length to the max line length of text
event.SetToolTip(itemData->GetSplittedFieldDescr());
}
示例14: OnSelChanging
void CBookmarksDialog::OnSelChanging(wxTreeEvent& event)
{
if (!Verify())
{
event.Veto();
return;
}
UpdateBookmark();
}
示例15: onTreeBeginDrag
void BookmarkView::onTreeBeginDrag( wxTreeEvent& event ) {
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(event.GetItem()));
dragItem = nullptr;
dragItemId = nullptr;
SetCursor(wxCURSOR_CROSS);
if (!tvi) {
event.Veto();
return;
}
bool bAllow = false;
std::wstring dragItemName;
if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
bAllow = true;
dragItemName = BookmarkMgr::getActiveDisplayName(tvi->demod);
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT || tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
bAllow = true;
dragItemName = BookmarkMgr::getBookmarkEntryDisplayName(tvi->bookmarkEnt);
}
if (bAllow) {
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
wxColour textColor(ThemeMgr::mgr.currentTheme->text);
m_treeView->SetBackgroundColour(textColor);
m_treeView->SetForegroundColour(bgColor);
// m_treeView->SetToolTip("Dragging " + dragItemName);
dragItem = tvi;
dragItemId = event.GetItem();
visualDragItem = new BookmarkViewVisualDragItem(dragItemName);
event.Allow();
} else {
event.Veto();
}
}