void Refresh();
bool DeleteChild(TreeNode *child);
void DestroyChildren();
- const char *FullName() const;
+ const wxChar *FullName() const;
// get the associated key: make sure the pointer is !NULL
wxRegKey& Key() { if ( !m_pKey ) OnExpand(); return *m_pKey; }
void AddStdKeys();
private:
- DECLARE_EVENT_TABLE();
+ DECLARE_EVENT_TABLE()
};
// ----------------------------------------------------------------------------
void OnInfo (wxCommandEvent& event);
- DECLARE_EVENT_TABLE();
+ DECLARE_EVENT_TABLE()
private:
RegTreeCtrl *m_treeCtrl;
pNewNode->IsKey() ? strName : *pstrValue,
idImage);
- wxASSERT_MSG( pNewNode->m_id, "can't create tree control item!");
+ wxASSERT_MSG( pNewNode->m_id, wxT("can't create tree control item!"));
// save the pointer in the item
SetItemData(pNewNode->m_id, pNewNode);
{
if ( m_restoreStatus ) {
// restore it after OnItemExpanding()
- wxLogStatus("Ok");
+ wxLogStatus(wxT("Ok"));
wxSetCursor(*wxSTANDARD_CURSOR);
m_restoreStatus = FALSE;
long lId = GetSelection();
TreeNode *pNode = (TreeNode *)GetItemData(lId);
- wxCHECK_RET( pNode != NULL, "tree item without data?" );
+ wxCHECK_RET( pNode != NULL, wxT("tree item without data?") );
if ( pNode->IsRoot() ) {
- wxLogError("Can't create a subkey under the root key.");
+ wxLogError(wxT("Can't create a subkey under the root key."));
return;
}
if ( !pNode->IsKey() ) {
- wxLogError("Can't create a subkey under a value!");
+ wxLogError(wxT("Can't create a subkey under a value!"));
return;
}
wxRegKey key2a(key1, "key2a"), key2b(key1, "key2b");
if ( key2a.Create() && key2b.Create() ) {
// put some values under the newly created keys
- key1.SetValue("first_term", "10");
- key1.SetValue("second_term", "7");
+ key1.SetValue(wxT("first_term"), "10");
+ key1.SetValue(wxT("second_term"), "7");
key2a = "this is the unnamed value";
- key2b.SetValue("sum", 17);
+ key2b.SetValue(wxT("sum"), 17);
// refresh tree
pNode->Refresh();
- wxLogStatus("Test keys successfully added.");
+ wxLogStatus(wxT("Test keys successfully added."));
return;
}
}
- wxLogError("Creation of test keys failed.");
+ wxLogError(wxT("Creation of test keys failed."));
}
void RegTreeCtrl::OnChar(wxKeyEvent& event)
// expansion might take some time
wxSetCursor(*wxHOURGLASS_CURSOR);
- wxLogStatus("Working...");
+ wxLogStatus(wxT("Working..."));
wxYield(); // to give the status line a chance to refresh itself
m_restoreStatus = TRUE; // some time later...
TreeNode *pNode = GetNode(event);
if ( pNode->IsRoot() || pNode->Parent()->IsRoot() )
{
- wxLogStatus("This registry key can't be %s.",
- m_copyOnDrop ? "copied" : "moved");
+ wxLogStatus(wxT("This registry key can't be %s."),
+ m_copyOnDrop ? wxT("copied") : wxT("moved"));
}
else
{
- wxLogStatus("%s item %s...",
- m_copyOnDrop ? "Copying" : "Moving",
+ wxLogStatus(wxT("%s item %s..."),
+ m_copyOnDrop ? wxT("Copying") : wxT("Moving"),
pNode->FullName());
m_draggedItem = pNode;
void RegTreeCtrl::OnEndDrag(wxTreeEvent& event)
{
- wxCHECK_RET( m_draggedItem, "end drag without begin drag?" );
+ wxCHECK_RET( m_draggedItem, wxT("end drag without begin drag?") );
// clear the pointer anyhow
TreeNode *src = m_draggedItem;
dst = dst->Parent();
}
if ( !dst || dst->IsRoot() ) {
- wxLogError("Can't create a key here.");
+ wxLogError(wxT("Can't create a key here."));
return;
}
bool isKey = src->IsKey();
if ( (isKey && (src == dst)) ||
(!isKey && (dst->Parent() == src)) ) {
- wxLogStatus("Can't copy something on itself");
+ wxLogStatus(wxT("Can't copy something on itself"));
return;
}
if ( wxMessageBox(wxString::Format
(
- "Do you really want to %s the %s %s to %s?",
+ wxT("Do you really want to %s the %s %s to %s?"),
verb.c_str(),
what.c_str(),
nameSrc.c_str(),
wxRegKey keyDst(dst->Key(), src->m_strName);
ok = keyDst.Create(FALSE);
if ( !ok ) {
- wxLogError("Key '%s' already exists");
+ wxLogError(wxT("Key '%s' already exists"));
}
else {
ok = key.Copy(keyDst);
}
if ( !ok ) {
- wxLogError("Failed to %s registry %s.", verb.c_str(), what.c_str());
+ wxLogError(wxT("Failed to %s registry %s."),
+ verb.c_str(), what.c_str());
}
else {
dst->Refresh();
}
if ( !m_pKey->Open() ) {
- wxLogError("The key '%s' can't be opened.", FullName());
+ wxLogError(wxT("The key '%s' can't be opened."), FullName());
return FALSE;
}
if ( isEmpty ) {
// this is for the case when our last child was just deleted
- m_pTree->Collapse(Id());
+ wxTreeItemId theId(Id()); // Temp variable seems necessary for BC++
+ m_pTree->Collapse(theId);
// we won't be expanded any more
- m_pTree->SetItemHasChildren(Id(), FALSE);
+ m_pTree->SetItemHasChildren(theId, FALSE);
}
return TRUE;
if ( !IsKey() )
return;
- bool wasExpanded = m_pTree->IsExpanded(Id());
+ wxTreeItemId theId(Id()); // Temp variable seems necessary for BC++
+ bool wasExpanded = m_pTree->IsExpanded(theId);
if ( wasExpanded )
- m_pTree->Collapse(Id());
+ m_pTree->Collapse(theId);
OnCollapse();
- m_pTree->SetItemHasChildren(Id());
+ m_pTree->SetItemHasChildren(theId);
if ( wasExpanded ) {
- m_pTree->Expand(Id());
+ m_pTree->Expand(theId);
OnExpand();
}
}
{
int index = m_aChildren.Index(child);
wxCHECK_MSG( index != wxNOT_FOUND, FALSE,
- "our child in tree should be in m_aChildren" );
+ wxT("our child in tree should be in m_aChildren") );
m_aChildren.RemoveAt((size_t)index);
}
if ( ok ) {
- m_pTree->Delete(child->Id());
+ wxTreeItemId theId(child->Id()); // Temp variable seems necessary for BC++
+ m_pTree->Delete(theId);
Refresh();
}
long lId = m_aChildren[n]->Id();
// no, wxTreeCtrl will do it
//delete m_aChildren[n];
- m_pTree->Delete(lId);
+ wxTreeItemId theId(lId); // Temp variable seems necessary for BC++
+ m_pTree->Delete(theId);
}
m_aChildren.Empty();
delete m_pKey;
}
-const char *RegTreeCtrl::TreeNode::FullName() const
+const wxChar *RegTreeCtrl::TreeNode::FullName() const
{
static wxString s_strName;
if ( IsRoot() ) {
- return "Registry Root";
+ return wxT("Registry Root");
}
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();
- s_strName << '\\' << m_strName;
+ s_strName << wxT('\\') << m_strName;
return s_strName;
}
lParent = GetParent(lCurrent);
if ( lParent == 0 ) {
- wxLogError("Can't delete root key.");
+ wxLogError(wxT("Can't delete root key."));
return;
}
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent),
*pParent = (TreeNode *)GetItemData(lParent);
- wxCHECK_RET( pCurrent && pParent, "either node or parent without data?" );
+ wxCHECK_RET(pCurrent && pParent, wxT("either node or parent without data?"));
if ( pParent->IsRoot() ) {
- wxLogError("Can't delete standard key.");
+ wxLogError(wxT("Can't delete standard key."));
return;
}
wxString what = pCurrent->IsKey() ? "key" : "value";
if ( wxMessageBox(wxString::Format
(
- "Do you really want to delete this %s?",
+ wxT("Do you really want to delete this %s?"),
what.c_str()
),
"Confirmation",
long lCurrent = GetSelection();
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
- wxCHECK_RET( pCurrent != NULL, "node without data?" );
+ wxCHECK_RET( pCurrent != NULL, wxT("node without data?") );
wxASSERT( pCurrent->IsKey() ); // check must have been done before
if ( pCurrent->IsRoot() ) {
- wxLogError("Can't create a new key under the root key.");
+ wxLogError(wxT("Can't create a new key under the root key."));
return;
}
long lCurrent = GetSelection();
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
- wxCHECK_RET( pCurrent != NULL, "node without data?" );
+ wxCHECK_RET( pCurrent != NULL, wxT("node without data?") );
wxASSERT( pCurrent->IsKey() ); // check must have been done before
if ( pCurrent->IsRoot() ) {
- wxLogError("Can't create a new value under the root key.");
+ wxLogError(wxT("Can't create a new value under the root key."));
return;
}
long lCurrent = GetSelection();
TreeNode *pCurrent = (TreeNode *)GetItemData(lCurrent);
- wxCHECK_RET( pCurrent != NULL, "node without data?" );
+ wxCHECK_RET( pCurrent != NULL, wxT("node without data?") );
wxASSERT( pCurrent->IsKey() ); // check must have been done before
if ( pCurrent->IsRoot() ) {
- wxLogError("Can't create a new value under the root key.");
+ wxLogError(wxT("Can't create a new value under the root key."));
return;
}
if ( !pCurrent || pCurrent->IsRoot() )
{
- wxLogStatus("No properties");
+ wxLogStatus(wxT("No properties"));
return;
}
size_t nSubKeys, nValues;
if ( !key.GetKeyInfo(&nSubKeys, NULL, &nValues, NULL) )
{
- wxLogError("Couldn't get key info");
+ wxLogError(wxT("Couldn't get key info"));
}
else
{
- wxLogMessage("Key '%s' has %u subkeys and %u values.",
+ wxLogMessage(wxT("Key '%s' has %u subkeys and %u values."),
key.GetName().c_str(), nSubKeys, nValues);
}
}
else // it's a value
{
TreeNode *parent = pCurrent->Parent();
- wxCHECK_RET( parent, "reg value without key?" );
+ wxCHECK_RET( parent, wxT("reg value without key?") );
const wxRegKey& key = parent->Key();
- const char *value = pCurrent->m_strName.c_str();
- wxLogMessage("Value '%s' under the key '%s' is of type "
- "%d (%s).",
+ const wxChar *value = pCurrent->m_strName.c_str();
+ wxLogMessage(wxT("Value '%s' under the key '%s' is of type ")
+ wxT("%d (%s)."),
value,
parent->m_strName.c_str(),
key.GetValueType(value),
- key.IsNumericValue(value) ? "numeric" : "string");
+ key.IsNumericValue(value) ? wxT("numeric") : wxT("string"));
}
}
TreeNode *pNode = (TreeNode *)GetItemData(lId);
- wxCHECK_RET( pNode != NULL, "tree item without data?" );
+ wxCHECK_RET( pNode != NULL, wxT("tree item without data?") );
pNode->Refresh();
}