return str;
}
+static inline int StringToInt(const wxString& s)
+{
+ long tmp;
+ s.ToLong(&tmp);
+
+ return int(tmp);
+}
+
// Convert a string to a wxFont
wxFont apStringToFont(const wxString& str)
{
if (i == 0)
{
- StringToInt(token, & pointSize);
+ pointSize = StringToInt(token);
#if defined(__WXGTK__) || defined(__WXMAC__)
if (pointSize < 8)
pointSize = 8;
#endif
}
else if (i == 1)
- StringToInt(token, & family);
+ family = StringToInt(token);
else if (i == 2)
- StringToInt(token, & style);
+ style = StringToInt(token);
else if (i == 3)
- StringToInt(token, & weight);
+ weight = StringToInt(token);
else if (i == 4)
- StringToInt(token, & underlined);
+ underlined = StringToInt(token);
else if (i == 5)
{
facename = token;
#endif
contextButton->SetHelpText(_("Invokes context-sensitive help for the clicked-on window."));
+#if 0
if (wxGetApp().UsingTooltips())
{
contextButton->SetToolTip(_("Invokes context-sensitive help for the clicked-on window."));
}
#endif
+#endif
}
// Get selected wxNotebook page
wxIconInfo* wxIconTable::FindInfo(const wxString& name) const
{
- wxNode* node = First();
+ wxNode* node = GetFirst();
while (node)
{
- wxIconInfo* info = (wxIconInfo*) node->Data();
+ wxIconInfo* info = (wxIconInfo*) node->GetData();
if (info->GetName() == name)
return info;
- node = node->Next();
+ node = node->GetNext();
}
return NULL;
}
s += c;
}
return s;
-}
\ No newline at end of file
+}
+
+// Match 'matchText' against 'matchAgainst', optionally constraining to
+// whole-word only.
+bool ctMatchString(const wxString& matchAgainst, const wxString& matchText, bool wholeWordOnly)
+{
+ // Fast operation if not matching against whole words only
+ if (!wholeWordOnly)
+ return (matchAgainst.Find(matchText) != -1);
+
+ wxString left(matchAgainst);
+ bool success = FALSE;
+ int pos = 0;
+ int matchTextLen = (int) matchText.Length();
+ while (!success && !matchAgainst.IsEmpty())
+ {
+ pos = left.Find(matchText);
+ if (pos == -1)
+ return FALSE;
+
+ bool firstCharOK = FALSE;
+ bool lastCharOK = FALSE;
+ if (pos == 0 || !wxIsalnum(left[(size_t) (pos-1)]))
+ firstCharOK = TRUE;
+
+ if (((pos + matchTextLen) == (int) left.Length()) || !wxIsalnum(left[(size_t) (pos + matchTextLen)]))
+ lastCharOK = TRUE;
+
+ if (firstCharOK && lastCharOK)
+ success = TRUE;
+
+ left = left.Mid(pos+1);
+ }
+ return success;
+}