function.tex
来自「Wxpython Implemented on Windows CE, Sou」· TEX 代码 · 共 1,826 行 · 第 1/5 页
TEX
1,826 行
\membersection{::wxShell}\label{wxshell}
\func{bool}{wxShell}{\param{const wxString\& }{command = NULL}}
Executes a command in an interactive shell window. If no command is
specified, then just the shell is spawned.
See also \helpref{wxExecute}{wxexecute}, \helpref{Exec sample}{sampleexec}.
\wxheading{Include files}
<wx/utils.h>
\membersection{::wxShutdown}\label{wxshutdown}
\func{bool}{wxShutdown}{\param{wxShutdownFlags}{flags}}
This function shuts down or reboots the computer depending on the value of the
{\it flags}. Please notice that doing this requires the corresponding access
rights (superuser under Unix, {\tt SE\_SHUTDOWN} privilege under Windows NT)
and that this function is only implemented under Unix and Win32.
\wxheading{Parameters}
\docparam{flags}{Either {\tt wxSHUTDOWN\_POWEROFF} or {\tt wxSHUTDOWN\_REBOOT}}
\wxheading{Returns}
\true on success, \false if an error occurred.
\wxheading{Include files}
<wx/utils.h>
\section{Thread functions}\label{threadfunctions}
The functions and macros here mainly exist to make it writing the code which
may be compiled in multi thread build ({\tt wxUSE\_THREADS} $= 1$) as well as
in single thread configuration ({\tt wxUSE\_THREADS} $= 0$).
For example, a static variable must be protected against simultaneous access by
multiple threads in the former configuration but in the latter the extra
overhead of using the critical section is not needed. To solve this problem,
the \helpref{wxCRITICAL\_SECTION}{wxcriticalsectionmacro} macro may be used
to create and use the critical section only when needed.
\wxheading{Include files}
<wx/thread.h>
\wxheading{See also}
\helpref{wxThread}{wxthread}, \helpref{wxMutex}{wxmutex}, \helpref{Multithreading overview}{wxthreadoverview}
\membersection{wxCRIT\_SECT\_DECLARE}\label{wxcritsectdeclare}
\func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}}
This macro declares a (static) critical section object named {\it cs} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
\membersection{wxCRIT\_SECT\_DECLARE\_MEMBER}\label{wxcritsectdeclaremember}
\func{}{wxCRIT\_SECT\_DECLARE}{\param{}{cs}}
This macro declares a critical section object named {\it cs} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$. As it doesn't
include the {\tt static} keyword (unlike
\helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare}), it can be used to declare
a class or struct member which explains its name.
\membersection{wxCRIT\_SECT\_LOCKER}\label{wxcritsectlocker}
\func{}{wxCRIT\_SECT\_LOCKER}{\param{}{name}, \param{}{cs}}
This macro creates a \helpref{critical section lock}{wxcriticalsectionlocker}
object named {\it name} and associated with the critical section {\it cs} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
\membersection{wxCRITICAL\_SECTION}\label{wxcriticalsectionmacro}
\func{}{wxCRITICAL\_SECTION}{\param{}{name}}
This macro combines \helpref{wxCRIT\_SECT\_DECLARE}{wxcritsectdeclare} and
\helpref{wxCRIT\_SECT\_LOCKER}{wxcritsectlocker}: it creates a static critical
section object and also the lock object associated with it. Because of this, it
can be only used inside a function, not at global scope. For example:
\begin{verbatim}
int IncCount()
{
static int s_counter = 0;
wxCRITICAL_SECTION(counter);
return ++s_counter;
}
\end{verbatim}
(note that we suppose that the function is called the first time from the main
thread so that the critical section object is initialized correctly by the time
other threads start calling it, if this is not the case this approach can
{\bf not} be used and the critical section must be made a global instead).
\membersection{wxENTER\_CRIT\_SECT}\label{wxentercritsect}
\func{}{wxENTER\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}}
This macro is equivalent to \helpref{cs.Enter()}{wxcriticalsectionenter} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
\membersection{::wxIsMainThread}\label{wxismainthread}
\func{bool}{wxIsMainThread}{\void}
Returns \true if this thread is the main one. Always returns \true if
{\tt wxUSE\_THREADS} is $0$.
\membersection{wxLEAVE\_CRIT\_SECT}\label{wxleavecritsect}
\func{}{wxLEAVE\_CRIT\_SECT}{\param{wxCriticalSection\& }{cs}}
This macro is equivalent to \helpref{cs.Leave()}{wxcriticalsectionleave} if
{\tt wxUSE\_THREADS} is $1$ and does nothing if it is $0$.
\membersection{::wxMutexGuiEnter}\label{wxmutexguienter}
\func{void}{wxMutexGuiEnter}{\void}
This function must be called when any thread other than the main GUI thread
wants to get access to the GUI library. This function will block the execution
of the calling thread until the main thread (or any other thread holding the
main GUI lock) leaves the GUI library and no other thread will enter the GUI
library until the calling thread calls \helpref{::wxMutexGuiLeave()}{wxmutexguileave}.
Typically, these functions are used like this:
\begin{verbatim}
void MyThread::Foo(void)
{
// before doing any GUI calls we must ensure that this thread is the only
// one doing it!
wxMutexGuiEnter();
// Call GUI here:
my_window->DrawSomething();
wxMutexGuiLeave();
}
\end{verbatim}
Note that under GTK, no creation of top-level windows is allowed in any
thread but the main one.
This function is only defined on platforms which support preemptive
threads.
\membersection{::wxMutexGuiLeave}\label{wxmutexguileave}
\func{void}{wxMutexGuiLeave}{\void}
See \helpref{::wxMutexGuiEnter()}{wxmutexguienter}.
This function is only defined on platforms which support preemptive
threads.
\section{File functions}\label{filefunctions}
\wxheading{Include files}
<wx/filefn.h>
\wxheading{See also}
\helpref{wxPathList}{wxpathlist}\\
\helpref{wxDir}{wxdir}\\
\helpref{wxFile}{wxfile}\\
\helpref{wxFileName}{wxfilename}
\membersection{::wxDos2UnixFilename}\label{wxdos2unixfilename}
\func{void}{wxDos2UnixFilename}{\param{wxChar *}{s}}
Converts a DOS to a Unix filename by replacing backslashes with forward
slashes.
\membersection{::wxFileExists}\label{functionwxfileexists}
\func{bool}{wxFileExists}{\param{const wxString\& }{filename}}
Returns true if the file exists and is a plain file.
\membersection{::wxFileModificationTime}\label{wxfilemodificationtime}
\func{time\_t}{wxFileModificationTime}{\param{const wxString\& }{filename}}
Returns time of last modification of given file.
The return value is $0$ if an error occured (e.g. file not found).
\membersection{::wxFileNameFromPath}\label{wxfilenamefrompath}
\func{wxString}{wxFileNameFromPath}{\param{const wxString\& }{path}}
\func{char *}{wxFileNameFromPath}{\param{char *}{path}}
{\bf NB:} This function is obsolete, please use
\helpref{wxFileName::SplitPath}{wxfilenamesplitpath} instead.
Returns the filename for a full path. The second form returns a pointer to
temporary storage that should not be deallocated.
\membersection{::wxFindFirstFile}\label{wxfindfirstfile}
\func{wxString}{wxFindFirstFile}{\param{const char *}{spec}, \param{int}{ flags = 0}}
This function does directory searching; returns the first file
that matches the path {\it spec}, or the empty string. Use \helpref{wxFindNextFile}{wxfindnextfile} to
get the next matching file. Neither will report the current directory "." or the
parent directory "..".
\wxheading{Warning}
As of wx 2.5.2, these functions are not thread-safe! (they use static variables). You probably want to use \helpref{wxDir::GetFirst}{wxdirgetfirst} or \helpref{wxDirTraverser}{wxdirtraverser} instead.
{\it spec} may contain wildcards.
{\it flags} may be wxDIR for restricting the query to directories, wxFILE for files or zero for either.
For example:
\begin{verbatim}
wxString f = wxFindFirstFile("/home/project/*.*");
while ( !f.empty() )
{
...
f = wxFindNextFile();
}
\end{verbatim}
\membersection{::wxFindNextFile}\label{wxfindnextfile}
\func{wxString}{wxFindNextFile}{\void}
Returns the next file that matches the path passed to \helpref{wxFindFirstFile}{wxfindfirstfile}.
See \helpref{wxFindFirstFile}{wxfindfirstfile} for an example.
\membersection{::wxGetDiskSpace}\label{wxgetdiskspace}
\func{bool}{wxGetDiskSpace}{\param{const wxString\& }{path}, \param{wxLongLong }{*total = NULL}, \param{wxLongLong }{*free = NULL}}
This function returns the total number of bytes and number of free bytes on
the disk containing the directory {\it path} (it should exist). Both
{\it total} and {\it free} parameters may be {\tt NULL} if the corresponding
information is not needed.
\wxheading{Returns}
\true on success, \false if an error occurred (for example, the
directory doesn't exist).
\wxheading{Portability}
This function is implemented for Win32,
Mac OS and generic Unix provided the system has {\tt statfs()} function.
This function first appeared in wxWidgets 2.3.2.
\membersection{::wxGetFileKind}\label{wxgetfilekind}
\func{wxFileKind}{wxGetFileKind}{\param{int }{fd}}
\func{wxFileKind}{wxGetFileKind}{\param{FILE *}{fp}}
Returns the type of an open file. Possible return values are:
\begin{verbatim}
enum wxFileKind
{
wxFILE_KIND_UNKNOWN,
wxFILE_KIND_DISK, // a file supporting seeking to arbitrary offsets
wxFILE_KIND_TERMINAL, // a tty
wxFILE_KIND_PIPE // a pipe
};
\end{verbatim}
\wxheading{Include files}
<wx/filefn.h>
\membersection{::wxGetOSDirectory}\label{wxgetosdirectory}
\func{wxString}{wxGetOSDirectory}{\void}
Returns the Windows directory under Windows; on other platforms returns the empty string.
\membersection{::wxIsAbsolutePath}\label{wxisabsolutepath}
\func{bool}{wxIsAbsolutePath}{\param{const wxString\& }{filename}}
Returns true if the argument is an absolute filename, i.e. with a slash
or drive name at the beginning.
\membersection{::wxDirExists}\label{functionwxdirexists}
\func{bool}{wxDirExists}{\param{const wxString\& }{dirname}}
Returns true if the path exists.
\membersection{::wxPathOnly}\label{wxpathonly}
\func{wxString}{wxPathOnly}{\param{const wxString\& }{path}}
Returns the directory part of the filename.
\membersection{::wxUnix2DosFilename}\label{wxunix2dosfilename}
\func{void}{wxUnix2DosFilename}{\param{wxChar *}{s}}
This function is deprecated, use \helpref{wxFileName}{wxfilename} instead.
Converts a Unix to a DOS filename by replacing forward
slashes with backslashes.
\membersection{wxCHANGE\_UMASK}\label{wxchangeumask}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?