Applied patch #845888 (Fixes compilation of regtest sample in Unicode/ANSI, debug/release, MSW/Univ builds of with OpenWatcom, Borland and MinGW); Cosmetic cleanup.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Dimitri Schoolwerth
2003-11-21 01:54:43 +00:00
parent 88b98c53ac
commit 721b839791

View File

@@ -26,13 +26,17 @@
# include "wx/wx.h"
#endif
#include "wx/log.h"
#include "wx/treectrl.h"
#include "wx/msw/registry.h"
#include "wx/msw/imaglist.h"
#include "wx/config.h"
#include "wx/imaglist.h"
#include "wx/tokenzr.h"
#if wxUSE_CONFIG_NATIVE && defined( __WXMSW__ )
# define DO_REGTEST 1
#else
# define DO_REGTEST 0
#endif
// ----------------------------------------------------------------------------
// application type
// ----------------------------------------------------------------------------
@@ -54,12 +58,14 @@ public:
ClosedKey,
OpenedKey,
TextValue,
BinaryValue,
BinaryValue
};
RegImageList();
};
#if DO_REGTEST
// ----------------------------------------------------------------------------
// our control
// ----------------------------------------------------------------------------
@@ -90,7 +96,7 @@ public:
// operations
void GoTo(const wxString& location);
void Refresh();
void DoRefresh();
void DeleteSelected();
void ShowProperties();
void CreateNewKey(const wxString& strName);
@@ -143,7 +149,7 @@ private:
TreeNode *m_pRoot;
TreeNode *m_draggedItem; // the item being dragged
bool m_copyOnDrop; // if FALSE, then move
bool m_copyOnDrop; // if false, then move
bool m_restoreStatus; // after OnItemExpanding()
@@ -158,6 +164,7 @@ public:
const wxString& strName,
int idImage = RegImageList::ClosedKey,
const wxString *pstrValue = NULL);
// add standard registry keys
void AddStdKeys();
@@ -165,6 +172,8 @@ private:
DECLARE_EVENT_TABLE()
};
#endif // #if DO_REGTEST
// ----------------------------------------------------------------------------
// the main window of our application
// ----------------------------------------------------------------------------
@@ -197,7 +206,10 @@ public:
DECLARE_EVENT_TABLE()
private:
#if DO_REGTEST
RegTreeCtrl *m_treeCtrl;
#endif
};
// ----------------------------------------------------------------------------
@@ -244,6 +256,8 @@ BEGIN_EVENT_TABLE(RegFrame, wxFrame)
EVT_MENU(Menu_Info, RegFrame::OnInfo)
END_EVENT_TABLE()
#if DO_REGTEST
BEGIN_EVENT_TABLE(RegTreeCtrl, wxTreeCtrl)
EVT_TREE_DELETE_ITEM (Ctrl_RegTree, RegTreeCtrl::OnDeleteItem)
EVT_TREE_ITEM_EXPANDING(Ctrl_RegTree, RegTreeCtrl::OnItemExpanding)
@@ -261,6 +275,8 @@ BEGIN_EVENT_TABLE(RegTreeCtrl, wxTreeCtrl)
EVT_IDLE (RegTreeCtrl::OnIdle)
END_EVENT_TABLE()
#endif
// ============================================================================
// implementation
// ============================================================================
@@ -304,11 +320,11 @@ bool RegApp::OnInit()
{
// create the main frame window and show it
RegFrame *frame = new RegFrame(NULL, _T("wxRegTest"), 50, 50, 600, 350);
frame->Show(TRUE);
frame->Show(true);
SetTopWindow(frame);
return TRUE;
return true;
}
// ----------------------------------------------------------------------------
@@ -339,9 +355,11 @@ RegFrame::RegFrame(wxFrame *parent, wxChar *title, int x, int y, int w, int h)
pMenu->Append(CreateRegistryMenu(), _T("&Registry"));
SetMenuBar(pMenu);
#if DO_REGTEST
// create child controls
// ---------------------
m_treeCtrl = new RegTreeCtrl(this, Ctrl_RegTree);
#endif
// create the status line
// ----------------------
@@ -350,16 +368,18 @@ RegFrame::RegFrame(wxFrame *parent, wxChar *title, int x, int y, int w, int h)
RegFrame::~RegFrame()
{
#if DO_REGTEST
// this makes deletion of it *much* quicker
m_treeCtrl->Hide();
#endif
}
void RegFrame::OnQuit(wxCommandEvent& event)
void RegFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
Close(true);
}
void RegFrame::OnAbout(wxCommandEvent& event)
void RegFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageDialog dialog(this,
_T("wxRegistry sample\n")
@@ -371,94 +391,121 @@ void RegFrame::OnAbout(wxCommandEvent& event)
void RegFrame::OnTest(wxCommandEvent& WXUNUSED(event))
{
#if DO_REGTEST
m_treeCtrl->OnMenuTest();
#endif
}
void RegFrame::OnGoTo(wxCommandEvent& WXUNUSED(event))
{
static wxString s_location = _T("HKEY_CURRENT_USER\\Software\\wxWindows");
wxString location = wxGetTextFromUser
(
wxString location = wxGetTextFromUser(
_T("Enter the location to go to:"),
_T("wxRegTest question"),
s_location,
this
);
this);
if ( !location )
return;
s_location = location;
#if DO_REGTEST
m_treeCtrl->GoTo(location);
#endif
}
void RegFrame::OnExpand(wxCommandEvent& WXUNUSED(event))
{
m_treeCtrl->ExpandItem(m_treeCtrl->GetSelection(), wxTREE_EXPAND_EXPAND);
#if DO_REGTEST
m_treeCtrl->Expand(m_treeCtrl->GetSelection());
#endif
}
void RegFrame::OnCollapse(wxCommandEvent& WXUNUSED(event))
{
m_treeCtrl->ExpandItem(m_treeCtrl->GetSelection(), wxTREE_EXPAND_COLLAPSE);
#if DO_REGTEST
m_treeCtrl->Collapse(m_treeCtrl->GetSelection());
#endif
}
void RegFrame::OnToggle(wxCommandEvent& WXUNUSED(event))
{
m_treeCtrl->ExpandItem(m_treeCtrl->GetSelection(), wxTREE_EXPAND_TOGGLE);
#if DO_REGTEST
m_treeCtrl->Toggle(m_treeCtrl->GetSelection());
#endif
}
void RegFrame::OnRefresh(wxCommandEvent& WXUNUSED(event))
{
m_treeCtrl->Refresh();
#if DO_REGTEST
m_treeCtrl->DoRefresh();
#endif
}
void RegFrame::OnDelete(wxCommandEvent& WXUNUSED(event))
{
#if DO_REGTEST
m_treeCtrl->DeleteSelected();
#endif
}
void RegFrame::OnNewKey(wxCommandEvent& WXUNUSED(event))
{
if ( m_treeCtrl->IsKeySelected() ) {
#if DO_REGTEST
if ( m_treeCtrl->IsKeySelected() )
{
m_treeCtrl->CreateNewKey(
wxGetTextFromUser(_T("Enter the name of the new key")));
}
#endif
}
void RegFrame::OnNewText(wxCommandEvent& WXUNUSED(event))
{
if ( m_treeCtrl->IsKeySelected() ) {
#if DO_REGTEST
if ( m_treeCtrl->IsKeySelected() )
{
m_treeCtrl->CreateNewTextValue(
wxGetTextFromUser(_T("Enter the name for the new text value")));
}
#endif
}
void RegFrame::OnNewBinary(wxCommandEvent& WXUNUSED(event))
{
if ( m_treeCtrl->IsKeySelected() ) {
#if DO_REGTEST
if ( m_treeCtrl->IsKeySelected() )
{
m_treeCtrl->CreateNewBinaryValue(
wxGetTextFromUser(_T("Enter the name for the new binary value")));
}
#endif
}
void RegFrame::OnInfo(wxCommandEvent& WXUNUSED(event))
{
#if DO_REGTEST
m_treeCtrl->ShowProperties();
#endif
}
// ----------------------------------------------------------------------------
// RegImageList
// ----------------------------------------------------------------------------
RegImageList::RegImageList() : wxImageList(16, 16, TRUE)
RegImageList::RegImageList() : wxImageList(16, 16, true)
{
// should be in sync with enum RegImageList::RegIcon
static const wxChar *aszIcons[] = { _T("key1"),_T("key2"),_T("key3"),_T("value1"),_T("value2") };
wxString str = _T("icon_");
for ( unsigned int n = 0; n < WXSIZEOF(aszIcons); n++ ) {
for ( unsigned int n = 0; n < WXSIZEOF(aszIcons); n++ )
{
Add(wxIcon(str + aszIcons[n], wxBITMAP_TYPE_ICO_RESOURCE));
}
}
#if DO_REGTEST
// ----------------------------------------------------------------------------
// RegTreeCtrl
// ----------------------------------------------------------------------------
@@ -476,9 +523,16 @@ RegTreeCtrl::TreeNode *RegTreeCtrl::InsertNewTreeNode(TreeNode *pParent,
pNewNode->m_strName = strName;
pNewNode->m_bKey = pstrValue == NULL;
pNewNode->m_pKey = NULL;
pNewNode->m_id = InsertItem(pParent ? pParent->Id() : 0,
if (pParent)
{
pNewNode->m_id = AppendItem(pParent->Id(),
pNewNode->IsKey() ? strName : *pstrValue,
idImage);
}
else
{
pNewNode->m_id = AddRoot(strName);
}
wxASSERT_MSG( pNewNode->m_id, wxT("can't create tree control item!"));
@@ -486,14 +540,17 @@ RegTreeCtrl::TreeNode *RegTreeCtrl::InsertNewTreeNode(TreeNode *pParent,
SetItemData(pNewNode->m_id, pNewNode);
// add it to the list of parent's children
if ( pParent != NULL ) {
if ( pParent != NULL )
{
pParent->m_aChildren.Add(pNewNode);
}
if ( pNewNode->IsKey() ) {
if ( pNewNode->IsKey() )
{
SetItemHasChildren(pNewNode->Id());
if ( !pNewNode->IsRoot() ) {
if ( !pNewNode->IsRoot() )
{
// set the expanded icon as well
SetItemImage(pNewNode->Id(),
RegImageList::OpenedKey,
@@ -510,12 +567,12 @@ RegTreeCtrl::RegTreeCtrl(wxWindow *parent, wxWindowID id)
{
// init members
m_draggedItem = NULL;
m_restoreStatus = FALSE;
m_restoreStatus = false;
// create the image list
// ---------------------
m_imageList = new RegImageList;
SetImageList(m_imageList, wxIMAGE_LIST_NORMAL);
SetImageList(m_imageList);
// create root keys
// ----------------
@@ -535,7 +592,8 @@ RegTreeCtrl::~RegTreeCtrl()
void RegTreeCtrl::AddStdKeys()
{
for ( unsigned int ui = 0; ui < wxRegKey::nStdKeys; ui++ ) {
for ( unsigned int ui = 0; ui < wxRegKey::nStdKeys; ui++ )
{
InsertNewTreeNode(m_pRoot, wxRegKey::GetStdKeyName(ui));
}
}
@@ -546,12 +604,13 @@ void RegTreeCtrl::AddStdKeys()
void RegTreeCtrl::OnIdle(wxIdleEvent& WXUNUSED(event))
{
if ( m_restoreStatus ) {
if ( m_restoreStatus )
{
// restore it after OnItemExpanding()
wxLogStatus(wxT("Ok"));
wxSetCursor(*wxSTANDARD_CURSOR);
m_restoreStatus = FALSE;
m_restoreStatus = false;
}
}
@@ -559,7 +618,8 @@ void RegTreeCtrl::OnRightClick(wxMouseEvent& event)
{
int iFlags;
long lId = HitTest(wxPoint(event.GetX(), event.GetY()), iFlags);
if ( iFlags & wxTREE_HITTEST_ONITEMLABEL ) {
if ( iFlags & wxTREE_HITTEST_ONITEMLABEL )
{
// select the item first
SelectItem(lId);
}
@@ -569,7 +629,7 @@ void RegTreeCtrl::OnRightClick(wxMouseEvent& event)
}
void RegTreeCtrl::OnDeleteItem(wxTreeEvent& event)
void RegTreeCtrl::OnDeleteItem(wxTreeEvent& WXUNUSED(event))
{
}
@@ -581,19 +641,24 @@ void RegTreeCtrl::OnMenuTest()
wxCHECK_RET( pNode != NULL, wxT("tree item without data?") );
if ( pNode->IsRoot() ) {
if ( pNode->IsRoot() )
{
wxLogError(wxT("Can't create a subkey under the root key."));
return;
}
if ( !pNode->IsKey() ) {
if ( !pNode->IsKey() )
{
wxLogError(wxT("Can't create a subkey under a value!"));
return;
}
wxRegKey key1(pNode->Key(), _T("key1"));
if ( key1.Create() ) {
if ( key1.Create() )
{
wxRegKey key2a(key1, _T("key2a")), key2b(key1, _T("key2b"));
if ( key2a.Create() && key2b.Create() ) {
if ( key2a.Create() && key2b.Create() )
{
// put some values under the newly created keys
key1.SetValue(wxT("first_term"), _T("10"));
key1.SetValue(wxT("second_term"), _T("7"));
@@ -612,7 +677,7 @@ void RegTreeCtrl::OnMenuTest()
void RegTreeCtrl::OnChar(wxKeyEvent& event)
{
switch ( event.KeyCode() )
switch ( event.GetKeyCode() )
{
case WXK_DELETE:
DeleteSelected();
@@ -632,7 +697,7 @@ void RegTreeCtrl::OnChar(wxKeyEvent& event)
void RegTreeCtrl::OnSelChanged(wxTreeEvent& event)
{
wxFrame *pFrame = (wxFrame *)(wxWindow::GetParent());
wxFrame *pFrame = (wxFrame *) wxWindow::GetParent();
pFrame->SetStatusText(GetNode(event)->FullName(), 1);
}
@@ -645,15 +710,18 @@ void RegTreeCtrl::OnItemExpanding(wxTreeEvent& event)
wxSetCursor(*wxHOURGLASS_CURSOR);
wxLogStatus(wxT("Working..."));
wxYield(); // to give the status line a chance to refresh itself
m_restoreStatus = TRUE; // some time later...
m_restoreStatus = true; // some time later...
if ( pNode->IsKey() ) {
if ( bExpanding ) {
if ( pNode->IsKey() )
{
if ( bExpanding )
{
// expanding: add subkeys/values
if ( !pNode->OnExpand() )
return;
}
else {
else
{
// collapsing: clean up
pNode->OnCollapse();
}
@@ -663,12 +731,14 @@ void RegTreeCtrl::OnItemExpanding(wxTreeEvent& event)
void RegTreeCtrl::OnBeginEdit(wxTreeEvent& event)
{
TreeNode *pNode = GetNode(event);
if ( pNode->IsRoot() || pNode->Parent()->IsRoot() ) {
if ( pNode->IsRoot() || pNode->Parent()->IsRoot() )
{
wxLogStatus(_T("This registry key can't be renamed."));
event.Veto();
}
else {
else
{
m_nameOld = pNode->m_strName;
}
}
@@ -693,12 +763,14 @@ void RegTreeCtrl::OnEndEdit(wxTreeEvent& event)
ok = key.RenameValue(m_nameOld, name);
}
if ( !ok ) {
if ( !ok )
{
wxLogError(_T("Failed to rename '%s' to '%s'."),
m_nameOld.c_str(), name.c_str());
}
#if 0 // MSW tree ctrl doesn't like this at all, it hangs
else {
else
{
pNode->Refresh();
}
#endif // 0
@@ -736,11 +808,14 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
// where are we going to drop it?
TreeNode *dst = GetNode(event);
if ( dst && !dst->IsKey() ) {
if ( dst && !dst->IsKey() )
{
// we need a parent key
dst = dst->Parent();
}
if ( !dst || dst->IsRoot() ) {
if ( !dst || dst->IsRoot() )
{
wxLogError(wxT("Can't create a key here."));
return;
@@ -777,39 +852,48 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
}
bool ok;
if ( isKey ) {
if ( isKey )
{
wxRegKey& key = src->Key();
wxRegKey keyDst(dst->Key(), src->m_strName);
ok = keyDst.Create(FALSE);
if ( !ok ) {
ok = keyDst.Create(false);
if ( !ok )
{
wxLogError(wxT("Key '%s' already exists"), keyDst.GetName().c_str());
}
else {
else
{
ok = key.Copy(keyDst);
}
if ( ok && !m_copyOnDrop ) {
if ( ok && !m_copyOnDrop )
{
// delete the old key
ok = key.DeleteSelf();
if ( ok ) {
if ( ok )
{
src->Parent()->Refresh();
}
}
}
else { // value
else // value
{
wxRegKey& key = src->Parent()->Key();
ok = key.CopyValue(src->m_strName, dst->Key());
if ( ok && !m_copyOnDrop ) {
if ( ok && !m_copyOnDrop )
{
// we moved it, so delete the old one
ok = key.DeleteValue(src->m_strName);
}
}
if ( !ok ) {
if ( !ok )
{
wxLogError(wxT("Failed to %s registry %s."),
verb.c_str(), what.c_str());
}
else {
else
{
dst->Refresh();
}
}
@@ -820,33 +904,38 @@ void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
bool RegTreeCtrl::TreeNode::OnExpand()
{
// we add children only once
if ( !m_aChildren.IsEmpty() ) {
if ( !m_aChildren.IsEmpty() )
{
// we've been already expanded
return TRUE;
return true;
}
if ( IsRoot() ) {
if ( IsRoot() )
{
// we're the root key
m_pTree->AddStdKeys();
return TRUE;
return true;
}
if ( Parent()->IsRoot() ) {
if ( Parent()->IsRoot() )
{
// we're a standard key
m_pKey = new wxRegKey(m_strName);
}
else {
else
{
// we're a normal key
m_pKey = new wxRegKey(*(Parent()->m_pKey), m_strName);
}
if ( !m_pKey->Open() ) {
if ( !m_pKey->Open() )
{
wxLogError(wxT("The key '%s' can't be opened."), FullName());
return FALSE;
return false;
}
// if we're empty, we shouldn't be expandable at all
bool isEmpty = TRUE;
bool isEmpty = true;
// enumeration variables
long l;
@@ -855,17 +944,19 @@ bool RegTreeCtrl::TreeNode::OnExpand()
// enumerate all subkeys
bCont = m_pKey->GetFirstKey(str, l);
while ( bCont ) {
while ( bCont )
{
m_pTree->InsertNewTreeNode(this, str, RegImageList::ClosedKey);
bCont = m_pKey->GetNextKey(str, l);
// we have at least this key...
isEmpty = FALSE;
isEmpty = false;
}
// enumerate all values
bCont = m_pKey->GetFirstValue(str, l);
while ( bCont ) {
while ( bCont )
{
wxString strItem;
if (str.IsEmpty())
strItem = _T("<default>");
@@ -875,7 +966,8 @@ bool RegTreeCtrl::TreeNode::OnExpand()
// determine the appropriate icon
RegImageList::Icon icon;
switch ( m_pKey->GetValueType(str) ) {
switch ( m_pKey->GetValueType(str) )
{
case wxRegKey::Type_String:
case wxRegKey::Type_Expand_String:
case wxRegKey::Type_Multi_String:
@@ -909,19 +1001,20 @@ bool RegTreeCtrl::TreeNode::OnExpand()
bCont = m_pKey->GetNextValue(str, l);
// we have at least this value...
isEmpty = FALSE;
isEmpty = false;
}
if ( isEmpty ) {
if ( isEmpty )
{
// this is for the case when our last child was just deleted
wxTreeItemId theId(Id()); // Temp variable seems necessary for BC++
m_pTree->Collapse(theId);
// we won't be expanded any more
m_pTree->SetItemHasChildren(theId, FALSE);
m_pTree->SetItemHasChildren(theId, false);
}
return TRUE;
return true;
}
void RegTreeCtrl::TreeNode::OnCollapse()
@@ -944,7 +1037,8 @@ void RegTreeCtrl::TreeNode::Refresh()
OnCollapse();
m_pTree->SetItemHasChildren(theId);
if ( wasExpanded ) {
if ( wasExpanded )
{
m_pTree->Expand(theId);
OnExpand();
}
@@ -953,23 +1047,26 @@ void RegTreeCtrl::TreeNode::Refresh()
bool RegTreeCtrl::TreeNode::DeleteChild(TreeNode *child)
{
int index = m_aChildren.Index(child);
wxCHECK_MSG( index != wxNOT_FOUND, FALSE,
wxCHECK_MSG( index != wxNOT_FOUND, false,
wxT("our child in tree should be in m_aChildren") );
m_aChildren.RemoveAt((size_t)index);
bool ok;
if ( child->IsKey() ) {
if ( child->IsKey() )
{
// must close key before deleting it
child->OnCollapse();
ok = Key().DeleteKey(child->m_strName);
}
else {
else
{
ok = Key().DeleteValue(child->m_strName);
}
if ( ok ) {
if ( ok )
{
wxTreeItemId theId(child->Id()); // Temp variable seems necessary for BC++
m_pTree->Delete(theId);
@@ -983,7 +1080,8 @@ void RegTreeCtrl::TreeNode::DestroyChildren()
{
// destroy all children
size_t nCount = m_aChildren.GetCount();
for ( size_t n = 0; n < nCount; n++ ) {
for ( size_t n = 0; n < nCount; n++ )
{
long lId = m_aChildren[n]->Id();
// no, wxTreeCtrl will do it
//delete m_aChildren[n];
@@ -1003,10 +1101,12 @@ const wxChar *RegTreeCtrl::TreeNode::FullName() const
{
static wxString s_strName;
if ( IsRoot() ) {
if ( IsRoot() )
{
return wxT("Registry Root");
}
else {
else
{
// our own registry key might not (yet) exist or we might be a value,
// so just use the parent's and concatenate
s_strName = Parent()->FullName();
@@ -1026,30 +1126,36 @@ void RegTreeCtrl::GoTo(const wxString& location)
wxTreeItemId id = GetRootItem();
while ( tk.HasMoreTokens() ) {
while ( tk.HasMoreTokens() )
{
wxString subkey = tk.GetNextToken();
wxTreeItemId idCurrent = id;
if ( !IsExpanded(idCurrent) )
Expand(idCurrent);
long dummy;
wxTreeItemIdValue dummy;
id = GetFirstChild(idCurrent, dummy);
if ( idCurrent == GetRootItem() ) {
if ( idCurrent == GetRootItem() )
{
// special case: we understand both HKCU and HKEY_CURRENT_USER here
for ( size_t key = 0; key < wxRegKey::nStdKeys; key++ ) {
if ( subkey == wxRegKey::GetStdKeyName(key) ||
subkey == wxRegKey::GetStdKeyShortName(key) ) {
for ( size_t key = 0; key < wxRegKey::nStdKeys; key++ )
{
if ( subkey == wxRegKey::GetStdKeyName(key)
|| subkey == wxRegKey::GetStdKeyShortName(key) )
{
break;
}
id = GetNextChild(idCurrent, dummy);
}
}
else {
else
{
// enum all children
while ( id.IsOk() ) {
while ( id.IsOk() )
{
if ( subkey == ((TreeNode *)GetItemData(id))->m_strName )
break;
@@ -1057,7 +1163,8 @@ void RegTreeCtrl::GoTo(const wxString& location)
}
}
if ( !id.IsOk() ) {
if ( !id.IsOk() )
{
wxLogError(_T("No such key '%s'."), location.c_str());
return;
@@ -1073,7 +1180,8 @@ void RegTreeCtrl::DeleteSelected()
long lCurrent = GetSelection(),
lParent = GetItemParent(lCurrent);
if ( lParent == 0 ) {
if ( lParent == 0 )
{
wxLogError(wxT("Can't delete root key."));
return;
}
@@ -1083,7 +1191,8 @@ void RegTreeCtrl::DeleteSelected()
wxCHECK_RET(pCurrent && pParent, wxT("either node or parent without data?"));
if ( pParent->IsRoot() ) {
if ( pParent->IsRoot() )
{
wxLogError(wxT("Can't delete standard key."));
return;
}
@@ -1095,7 +1204,8 @@ void RegTreeCtrl::DeleteSelected()
what.c_str()
),
_T("Confirmation"),
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES ) {
wxICON_QUESTION | wxYES_NO | wxCANCEL, this) != wxYES )
{
return;
}
@@ -1111,7 +1221,8 @@ void RegTreeCtrl::CreateNewKey(const wxString& strName)
wxASSERT( pCurrent->IsKey() ); // check must have been done before
if ( pCurrent->IsRoot() ) {
if ( pCurrent->IsRoot() )
{
wxLogError(wxT("Can't create a new key under the root key."));
return;
}
@@ -1130,12 +1241,13 @@ void RegTreeCtrl::CreateNewTextValue(const wxString& strName)
wxASSERT( pCurrent->IsKey() ); // check must have been done before
if ( pCurrent->IsRoot() ) {
if ( pCurrent->IsRoot() )
{
wxLogError(wxT("Can't create a new value under the root key."));
return;
}
if ( pCurrent->Key().SetValue(strName, _T("")) )
if ( pCurrent->Key().SetValue(strName, wxEmptyString) )
pCurrent->Refresh();
}
@@ -1148,7 +1260,8 @@ void RegTreeCtrl::CreateNewBinaryValue(const wxString& strName)
wxASSERT( pCurrent->IsKey() ); // check must have been done before
if ( pCurrent->IsRoot() ) {
if ( pCurrent->IsRoot() )
{
wxLogError(wxT("Can't create a new value under the root key."));
return;
}
@@ -1205,12 +1318,12 @@ bool RegTreeCtrl::IsKeySelected() const
long lCurrent = GetSelection();
TreeNode *pCurrent = (TreeNode *) GetItemData(lCurrent);
wxCHECK( pCurrent != NULL, FALSE );
wxCHECK( pCurrent != NULL, false );
return pCurrent->IsKey();
}
void RegTreeCtrl::Refresh()
void RegTreeCtrl::DoRefresh()
{
long lId = GetSelection();
if ( !lId )
@@ -1223,3 +1336,4 @@ void RegTreeCtrl::Refresh()
pNode->Refresh();
}
#endif