/////////////////////////////////////////////////////////////////////////////
// Name: helpext.cpp
-// Purpose: an external help controller for wxWindows
+// Purpose: an external help controller for wxWidgets
// Author: Karsten Ballueder
// Modified by:
// Created: 04/01/98
#pragma hdrstop
#endif
-#if wxUSE_HELP && !defined(__WXWINCE__)
+#if wxUSE_HELP && !defined(__WXWINCE__) && (!defined(__WXMAC__) || defined(__WXMAC_OSX__))
#ifndef WX_PRECOMP
#include "wx/setup.h"
#ifdef __WXMSW__
#include <windows.h>
+#include "wx/msw/winundef.h"
#endif
// ----------------------------------------------------------------------------
// return false;
// }
// else
- return TRUE;
+ return true;
#elif defined(__DOS__)
<< WXEXTHELP_SEPARATOR << relativeURL << wxT(")");
success = wxExecute(command);
if(success != 0 ) // returns PID on success
- return TRUE;
+ return true;
}
}
#endif
wxBusyCursor b; // display a busy cursor
- if(! ifile.IsEmpty())
+ if(! ifile.empty())
{
file = ifile;
if(! wxIsAbsolutePath(file))
// set to be "de", then look in "/usr/local/myapp/help/de/"
// first and fall back to "/usr/local/myapp/help" if that
// doesn't exist.
- if(wxGetLocale() && !wxGetLocale()->GetName().IsEmpty())
+ if(wxGetLocale() && !wxGetLocale()->GetName().empty())
{
wxString newfile;
newfile << WXEXTHELP_SEPARATOR << wxGetLocale()->GetName();
- if(wxDirExists(newfile))
+ if(wxPathExists(newfile))
file = newfile;
else
{
const wxChar *cptr = wxGetLocale()->GetName().c_str();
while(*cptr && *cptr != wxT('_'))
newfile << *(cptr++);
- if(wxDirExists(newfile))
+ if(wxPathExists(newfile))
file = newfile;
}
}
#endif
- if(! wxDirExists(file))
- return FALSE;
+ if(! wxPathExists(file))
+ return false;
mapFile << file << WXEXTHELP_SEPARATOR << WXEXTHELP_MAPFILE;
}
mapFile = m_MapFile;
if(! wxFileExists(mapFile))
- return FALSE;
+ return false;
DeleteList();
m_MapList = new wxList;
FILE *input = wxFopen(mapFile,wxT("rt"));
if(! input)
- return FALSE;
+ return false;
do
{
if(fgets(buffer,WXEXTHELP_BUFLEN,input) && *buffer != WXEXTHELP_COMMENTCHAR)
break; // error
for(i=0; isdigit(buffer[i])||isspace(buffer[i])||buffer[i]=='-'; i++)
; // find begin of URL
- url = wxT("");
+ url = wxEmptyString;
while(buffer[i] && ! isspace(buffer[i]) && buffer[i] !=
WXEXTHELP_COMMENTCHAR)
url << (wxChar) buffer[i++];
while(buffer[i] && buffer[i] != WXEXTHELP_COMMENTCHAR)
i++;
- doc = wxT("");
+ doc = wxEmptyString;
if(buffer[i])
doc = wxString::FromAscii( (buffer + i + 1) ); // skip the comment character
m_MapList->Append(new wxExtHelpMapEntry(id,url,doc));
fclose(input);
m_MapFile = file; // now it's valid
- return TRUE;
+ return true;
}
wxExtHelpController::DisplayContents()
{
if(! m_NumOfEntries)
- return FALSE;
+ return false;
wxString contents;
wxList::compatibility_iterator node = m_MapList->GetFirst();
node = node->GetNext();
}
- bool rc = FALSE;
+ bool rc = false;
wxString file;
file << m_MapFile << WXEXTHELP_SEPARATOR << contents;
if(file.Contains(wxT('#')))
rc = DisplaySection(CONTENTS_ID);
// if not found, open homemade toc:
- return rc ? TRUE : KeywordSearch(wxT(""));
+ return rc ? true : KeywordSearch(wxEmptyString);
}
bool
wxExtHelpController::DisplaySection(int sectionNo)
{
if(! m_NumOfEntries)
- return FALSE;
+ return false;
wxBusyCursor b; // display a busy cursor
wxList::compatibility_iterator node = m_MapList->GetFirst();
return DisplayHelp(entry->url);
node = node->GetNext();
}
- return FALSE;
+ return false;
}
bool wxExtHelpController::DisplaySection(const wxString& section)
wxHelpSearchMode WXUNUSED(mode))
{
if(! m_NumOfEntries)
- return FALSE;
+ return false;
wxString *choices = new wxString[m_NumOfEntries];
wxString *urls = new wxString[m_NumOfEntries];
int idx = 0, j;
bool rc;
- bool showAll = k.IsEmpty();
+ bool showAll = k.empty();
wxList::compatibility_iterator node = m_MapList->GetFirst();
wxExtHelpMapEntry *entry;
{
entry = (wxExtHelpMapEntry *)node->GetData();
compB = entry->doc; compB.LowerCase();
- if((showAll || compB.Contains(k)) && ! compB.IsEmpty())
+ if((showAll || compB.Contains(k)) && ! compB.empty())
{
urls[idx] = entry->url;
// doesn't work:
// choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR));
- //if(choices[idx].IsEmpty()) // didn't contain the ';'
+ //if(choices[idx].empty()) // didn't contain the ';'
// choices[idx] = (**i).doc;
- choices[idx] = wxT("");
+ choices[idx] = wxEmptyString;
for(j=0;entry->doc.c_str()[j]
&& entry->doc.c_str()[j] != WXEXTHELP_COMMENTCHAR; j++)
choices[idx] << entry->doc.c_str()[j];
else if(idx == 0)
{
wxMessageBox(_("No entries found."));
- rc = FALSE;
+ rc = false;
}
else
{
if(idx != -1)
rc = DisplayHelp(urls[idx]);
else
- rc = FALSE;
+ rc = false;
}
delete[] urls;
delete[] choices;
bool wxExtHelpController::Quit()
{
- return TRUE;
+ return true;
}
void wxExtHelpController::OnQuit()