Added wxMenu::UpdateUI to wxMSW, wxGTK, wxMotif, wxStubs; rearranged/debugged

docs


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-02-06 13:32:46 +00:00
parent 98ffbab9d7
commit 631f1bfed5
33 changed files with 505 additions and 193 deletions

View File

@@ -358,6 +358,28 @@ overview}{wxfileoverview} for more details.
\twocolitem{\helpref{wxTextFile}{wxtextfile}}{Class for working with text files as with arrays of lines}
\end{twocollist}
{\large {\bf Stream classes}}
wxWindows has its own set of stream classes, as an alternative to often buggy standard stream
libraries, and to provide enhanced functionality.
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxStreamBase}{wxstreambase}}{Stream base class}
\twocolitem{\helpref{wxStreamBuffer}{wxstreambuffer}}{Stream buffer class}
\twocolitem{\helpref{wxInputStream}{wxinputstream}}{Input stream class}
\twocolitem{\helpref{wxOutputStream}{wxoutputstream}}{Output stream class}
\twocolitem{\helpref{wxFilterInputStream}{wxfilterinputstream}}{Filtered input stream class}
\twocolitem{\helpref{wxFilterOutputStream}{wxfilteroutputstream}}{Filtered output stream class}
\twocolitem{\helpref{wxDataInputStream}{wxdatainputstream}}{Platform-independent data input stream class}
\twocolitem{\helpref{wxDataOutputStream}{wxdataoutputstream}}{Platform-independent data output stream class}
\twocolitem{\helpref{wxFileInputStream}{wxfileinputstream}}{File input stream class}
\twocolitem{\helpref{wxFileOutputStream}{wxfileoutputstream}}{File output stream class}
\twocolitem{\helpref{wxZlibInputStream}{wxzlibinputstream}}{Zlib (compression) input stream class}
\twocolitem{\helpref{wxZlibOutputStream}{wxzliboutputstream}}{Zlib (compression) output stream class}
\twocolitem{\helpref{wxSocketInputStream}{wxsocketinputstream}}{Socket input stream class}
\twocolitem{\helpref{wxSocketOutputStream}{wxsocketoutputstream}}{Socket output stream class}
\end{twocollist}
{\large {\bf Miscellaneous}}
\begin{twocollist}\itemsep=0pt

View File

@@ -60,8 +60,8 @@ $$\image{14cm;0cm}{wxclass.ps}$$
\input cursor.tex
\input database.tex
\input dataobj.tex
\input date.tex
\input datstrm.tex
\input date.tex
\input dc.tex
\input ddeclint.tex
\input ddeconn.tex
@@ -89,6 +89,7 @@ $$\image{14cm;0cm}{wxclass.ps}$$
\input fildrptg.tex
\input filehist.tex
\input filetype.tex
\input strmfile.tex
\input fltinstr.tex
\input fltoutst.tex
\input focusevt.tex
@@ -178,6 +179,7 @@ $$\image{14cm;0cm}{wxclass.ps}$$
\input slider.tex
\input sckaddr.tex
\input socket.tex
\input strmsock.tex
\input spinbutt.tex
\input splitter.tex
\input statbmp.tex
@@ -186,9 +188,8 @@ $$\image{14cm;0cm}{wxclass.ps}$$
\input statusbr.tex
\input wxstring.tex
\input strlist.tex
\input stream.tex
\input strmbase.tex
\input strmext.tex
\input stream.tex
\input sysclevt.tex
\input settings.tex
\input tab.tex
@@ -220,7 +221,7 @@ $$\image{14cm;0cm}{wxclass.ps}$$
\input wave.tex
\input window.tex
\input windowdc.tex
\input strmzlib.tex
\input function.tex
\input keycode.tex

View File

@@ -1,114 +1,132 @@
\section{\class{wxDataStream}}\label{wxdatastream}
\section{\class{wxDataInputStream}}\label{wxdatainputstream}
This class provides functions that read and write integers or double in a
This class provides functions that read data types in a
portable way. So, a file written by an Intel processor can be read by a
Sparc or anything else.
\wxheading{Derived from}
\helpref{wxFilterInputStream}{wxfilterinputstream}\\
\helpref{wxInputStream}{wxinputstream}\\
\helpref{wxStreamBase}{wxstreambase}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxDataStream::wxDataStream}\label{wxdatastreamconstr}
\membersection{wxDataInputStream::wxDataInputStream}\label{wxdatainputstreamconstr}
\func{}{wxDataStream}{\param{istream\&}{ stream}}
\func{}{wxDataInputStream}{\param{wxInputStream\&}{ stream}}
Constructs a datastream object from a C++ input stream. Only read methods will
Constructs a datastream object from an input stream. Only read methods will
be available.
\wxheading{Parameters}
\docparam{stream}{The C++ input stream.}
\docparam{stream}{The input stream.}
\func{}{wxDataStream}{\param{istream\&}{ stream}}
\membersection{wxDataInputStream::\destruct{wxDataInputStream}}
Constructs a datastream object from a C++ input stream. Only read methods will
be available.
\func{}{\destruct{wxDataInputStream}}{\void}
\wxheading{Parameters}
Destroys the wxDataInputStream object.
\docparam{stream}{The C++ input stream.}
\membersection{wxDataStream::\destruct{wxDataStream}}
\func{}{\destruct{wxDataStream}}{\void}
Destroys the wxDataStream object.
\membersection{wxDataStream::Read8}
\membersection{wxDataInputStream::Read8}
\func{unsigned char}{Read8}{\void}
Reads a single byte from the stream.
\membersection{wxDataStream::Read16}
\membersection{wxDataInputStream::Read16}
\func{unsigned short}{Read16}{\void}
Reads a 16 bit integer from the stream.
\membersection{wxDataStream::Read32}
\membersection{wxDataInputStream::Read32}
\func{unsigned long}{Read32}{\void}
Reads a 32 bit integer from the stream.
\membersection{wxDataStream::ReadDouble}
\membersection{wxDataInputStream::ReadDouble}
\func{double}{ReadDouble}{\void}
Reads a double (IEEE encoded) from the stream.
\membersection{wxDataStream::ReadString}
\membersection{wxDataInputStream::ReadString}
\func{wxString}{wxDataStream::ReadString}{\void}
\func{wxString}{wxDataInputStream::ReadString}{\void}
Reads a string from a stream. Actually, this function first reads a byte
Reads a string from a stream. Actually, this function first reads a long integer
specifying the length of the string (without the last null character) and then
reads the string.
\membersection{wxDataStream::ReadLine}
\membersection{wxDataInputStream::ReadLine}
\func{wxString}{wxDataStream::ReadLine}{\void}
\func{wxString}{wxDataInputStream::ReadLine}{\void}
Reads a line from the stream. A line is a string which ends with \\n or \\r\\n.
\membersection{wxDataStream::Write8}
\section{\class{wxDataOutputStream}}\label{wxdataoutputstream}
\func{void}{wxDataStream::Write8}{{\param unsigned char }{i8}}
This class provides functions that write data types in a
portable way. So, a file written by an Intel processor can be read by a
Sparc or anything else.
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxDataOutputStream::wxDataOutputStream}\label{wxdataoutputstreamconstr}
\func{}{wxDataInputStream}{\param{wxOutputStream\&}{ stream}}
Constructs a datastream object from an output stream. Only read methods will
be available.
\wxheading{Parameters}
\docparam{stream}{The output stream.}
\membersection{wxDataOutputStream::\destruct{wxDataOutputStream}}
\func{}{\destruct{wxDataOutputStream}}{\void}
Destroys the wxDataOutputStream object.
\membersection{wxDataOutputStream::Write8}
\func{void}{wxDataOutputStream::Write8}{{\param unsigned char }{i8}}
Writes the single byte {\it i8} to the stream.
\membersection{wxDataStream::Write16}
\membersection{wxDataOutputStream::Write16}
\func{void}{wxDataStream::Write16}{{\param unsigned short }{i16}}
\func{void}{wxDataOutputStream::Write16}{{\param unsigned short }{i16}}
Writes the 16 bit integer {\it i16} to the stream.
\membersection{wxDataStream::Write32}
\membersection{wxDataOutputStream::Write32}
\func{void}{wxDataStream::Write32}{{\param unsigned long }{i32}}
\func{void}{wxDataOutputStream::Write32}{{\param unsigned long }{i32}}
Writes the 32 bit integer {\it i32} to the stream.
\membersection{wxDataStream::WriteDouble}
\membersection{wxDataOutputStream::WriteDouble}
\func{void}{wxDataStream::WriteDouble}{{\param double }{f}}
\func{void}{wxDataOutputStream::WriteDouble}{{\param double }{f}}
Writes the double {\it f} to the stream using the IEEE format.
\membersection{wxDataStream::WriteString}
\membersection{wxDataOutputStream::WriteString}
\func{void}{wxDataStream::WriteString}{{\param const wxString\& }{string}}
\func{void}{wxDataOutputStream::WriteString}{{\param const wxString\& }{string}}
Writes {\it string} to the stream. Actually, this method writes the size of
the string before writing {\it string} itself.
\membersection{wxDataStream::WriteLine}
\membersection{wxDataOutputStream::WriteLine}
\func{void}{wxDataStream::WriteLine}{{\param const wxString\& }{string}}
\func{void}{wxDataOutputStream::WriteLine}{{\param const wxString\& }{string}}
Writes {\it string} as a line. Depending on the operating system, it adds
\\n or \\r\\n.
$\backslash$n or $\backslash$r$\backslash$n.
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "referenc"
%%% End:

View File

@@ -5,7 +5,8 @@
\wxheading{Derived from}
\helpref{wxInputStream}{wxinputstream}
\helpref{wxInputStream}{wxinputstream}\\
\helpref{wxStreamBase}{wxstreambase}
\wxheading{Note}

View File

@@ -5,7 +5,8 @@
\wxheading{Derived from}
\helpref{wxOutputStream}{wxoutputstream}
\helpref{wxOutputStream}{wxoutputstream}\\
\helpref{wxStreamBase}{wxstreambase}
\wxheading{Note}

View File

@@ -66,6 +66,12 @@ For example:
Returns the next file that matches the path passed to \helpref{wxFindFirstFile}{wxfindfirstfile}.
\membersection{::wxGetOSDirectory}\label{wxgetosdirectory}
\func{wxString}{wxGetOSDirectory}{\void}
Returns the Windows directory under Windows; on other platforms returns the empty string.
\membersection{::wxIsAbsolutePath}
\func{bool}{wxIsAbsolutePath}{\param{const wxString\& }{filename}}

View File

@@ -330,6 +330,18 @@ This is relevant only to popup menus.
\helpref{wxMenu::SetTitle}{wxmenusettitle}
\membersection{wxMenu::UpdateUI}\label{wxmenuupdateui}
\constfunc{void}{UpdateUI}{\param{wxEvtHandler*}{ source = NULL}}
Sends events to {\it source} (or owning window if NULL) to update the
menu UI. This is called just before the menu is popped up with \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu}, but
the application may call it at other times if required.
\wxheading{See also}
\helpref{wxUpdateUIEvent}{wxupdateuievent}
\section{\class{wxMenuBar}}\label{wxmenubar}
A menu bar is a series of menus accessible from the top of a frame.

View File

@@ -1,39 +1,3 @@
% -----------------------------------------------------------------------------
% wxZlibInputStream
% -----------------------------------------------------------------------------
\section{\class{wxZlibInputStream}}
\wxheading{Derived from}
\helpref{wxFilterInputStream}{wxfilterinputstream}
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxInputStream}{wxinputstream}
\wxheading{Short description}
This stream uncompresses all data read from it. It uses the ``filtered''
stream to get new compressed data.
% -----------------------------------------------------------------------------
% wxZlibOutputStream
% -----------------------------------------------------------------------------
\section{\class{wxZlibOutputStream}}
\wxheading{Derived from}
\helpref{wxFilterOutputStream}{wxfilteroutputstream}
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxOutputStream}{woutputstream}
\wxheading{Short description}
This stream compresses all data written to it and passed the compressed data
to the ``filtered'' stream.
% -----------------------------------------------------------------------------
% wxFileInputStream
% -----------------------------------------------------------------------------
@@ -145,47 +109,3 @@ Returns TRUE if the stream is initialized and ready.
Initializes a new file stream in read-write mode using the specified
\it{iofilename} name.
% -----------------------------------------------------------------------------
% wxSocketInputStream
% -----------------------------------------------------------------------------
\section{\class{wxSocketInputStream}}
\wxheading{Derived from}
\helpref{wxInputStream}{wxinputStream}
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxSocketBase}{wxsocketbase}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxSocketInputStream::wxSocketInputStream}
\func{}{wxSocketInputStream}{\param{wxSocketBase\&}{ s}}
Initializes a new read-only socket stream using the specified initialized
socket connection.
% -----------------------------------------------------------------------------
% wxSocketOutputStream
% -----------------------------------------------------------------------------
\section{\class{wxSocketInputStream}}
\wxheading{Derived from}
\helpref{wxOutputStream}{wxoutputStream}
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxSocketBase}{wxsocketbase}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxSocketOutputStream::wxSocketOutputStream}
\func{}{wxSocketInputStream}{\param{wxSocketBase\&}{ s}}
Initializes a new write-only socket stream using the specified initialized
socket connection.

View File

@@ -0,0 +1,44 @@
% -----------------------------------------------------------------------------
% wxSocketInputStream
% -----------------------------------------------------------------------------
\section{\class{wxSocketInputStream}}
\wxheading{Derived from}
\helpref{wxInputStream}{wxinputStream}
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxSocketBase}{wxsocketbase}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxSocketInputStream::wxSocketInputStream}
\func{}{wxSocketInputStream}{\param{wxSocketBase\&}{ s}}
Initializes a new read-only socket stream using the specified initialized
socket connection.
% -----------------------------------------------------------------------------
% wxSocketOutputStream
% -----------------------------------------------------------------------------
\section{\class{wxSocketInputStream}}
\wxheading{Derived from}
\helpref{wxOutputStream}{wxoutputStream}
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxSocketBase}{wxsocketbase}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxSocketOutputStream::wxSocketOutputStream}
\func{}{wxSocketInputStream}{\param{wxSocketBase\&}{ s}}
Initializes a new write-only socket stream using the specified initialized
socket connection.

View File

@@ -0,0 +1,36 @@
% -----------------------------------------------------------------------------
% wxZlibInputStream
% -----------------------------------------------------------------------------
\section{\class{wxZlibInputStream}}
\wxheading{Derived from}
\helpref{wxFilterInputStream}{wxfilterinputstream}
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxInputStream}{wxinputstream}
\wxheading{Short description}
This stream uncompresses all data read from it. It uses the ``filtered''
stream to get new compressed data.
% -----------------------------------------------------------------------------
% wxZlibOutputStream
% -----------------------------------------------------------------------------
\section{\class{wxZlibOutputStream}}
\wxheading{Derived from}
\helpref{wxFilterOutputStream}{wxfilteroutputstream}
\wxheading{See also}
\helpref{wxStreamBuffer}{wxstreamBuffer}, \helpref{wxOutputStream}{wxoutputstream}
\wxheading{Short description}
This stream compresses all data written to it and passed the compressed data
to the ``filtered'' stream.

View File

@@ -2,7 +2,7 @@
Classes: \helpref{wxConfig}{wxconfigbase}
This overview briefly describes what the config classes are and what are the
This overview briefly describes what the config classes are and what they are
for. All the details about how to use them may be found in the description of
the \helpref{wxConfigBase}{wxconfigbase} class and the documentation of the
file, registry and INI file based implementations mentions all the
@@ -17,12 +17,12 @@ means that this information should be:
binary data, for example.
\item{2.} Small. For instance, it is not recommended to use the Windows
registry for amounts of data more than a couple of kilobytes.
\item{3.} Not performance critical, neither from speed nor from memory
\item{3.} Not performance critical, neither from speed nor from a memory
consumption point of view.
\end{itemize}
On the other hand, the provided features make them very useful for storing all
kind of small to medioum volumes of hierarchically organized heterogenous
On the other hand, the features provided make them very useful for storing all
kinds of small to medium volumes of hierarchically-organized, heterogenous
data. In short, this is a place where you can conveniently stuff all your data
(numbers and strings) organizing it in a tree where you use the
filesystem-like paths to specify the location of a piece of data. In
@@ -33,17 +33,18 @@ differences between the Windows registry and the standard Unix text format
configuration files. Other (future) implementations of wxConfigBase might also
understand GTK ressource files or their analogues on the KDE side.
In any case, each implementation of wxConfigBase does its best (although due
In any case, each implementation of wxConfigBase does its best to
make the data look the same way everywhere. Due
to the limitations of the underlying physical storage as in the case of
wxIniConfigs it may not implement 100\% of the base class functionality) to
make the data look the same way everywhere. So you have the groups of entries
and the entries themselves. Each entry contains either a string or a number
(or a boolean value... support for other types of data such as dates or
wxIniConfig, it may not implement 100\% of the base class functionality.
There are groups of entries and the entries themselves. Each entry contains either a string or a number
(or a boolean value; support for other types of data such as dates or
timestamps is planned) and is identified by the full path to it: something
like /MyApp/UserPreferences/Colors/Foreground. The previous elements in the
path are the group names, each name may contain an arbitrary number of entries
path are the group names, and each name may contain an arbitrary number of entries
and subgroups. The path components are {\bf always} separated with a slash,
even though some implementations use the backslash internally. The further
even though some implementations use the backslash internally. Further
details (including how to read/write these entries) may be found in
\helpref{wxConfigBase}{wxconfigbase} documentation.
the documentation for \helpref{wxConfigBase}{wxconfigbase}.

View File

@@ -4,7 +4,7 @@ The wxTextFile is a simple class which allows to work with text files on line by
line basis. It also understands the differences in line termination characters
under different platforms and will not do anything bad to files with "non
native" line termination sequences - in fact, it can be also used to modify the
text files and chaneg the line termination characters from one type (say DOS) to
text files and change the line termination characters from one type (say DOS) to
another (say Unix).
One word of warning: the class is not at all optimized for big files and so it
@@ -34,9 +34,9 @@ changed with \helpref{GoToLine}{wxtextfilegotoline}.
\item Add/remove lines to the file: \helpref{AddLine}{wxtextfileaddline} and
\helpref{InsertLine}{wxtextfileinsertline} add new lines while
\helpref{RemoveLine}{wxtextfileremoveline} deletes the existing ones.
\item Save your changes: notice that the changes you do to the file will {\bf
not} be saved automatically, calling \helpref{Close}{wxtextfileclose} or doing
nothing discards them! To save the chanegs you must explicitly call
\item Save your changes: notice that the changes you make to the file will {\bf
not} be saved automatically; calling \helpref{Close}{wxtextfileclose} or doing
nothing discards them! To save the changes you must explicitly call
\helpref{Write}{wxtextfilewrite} - here, you may also change the line
termination type if you wish.
\end{itemize}
@@ -145,7 +145,7 @@ GoToLine().
\constfunc{void}{GoToLine}{\param{size\_t }{n}}
Changes the value returned by \helpref{GetCurrentLine}{wxtextfilegetcurrentline}
and used by \helpref{GetFirstLine()}{wxtextfilegetfirstline}()/\helpref{GetNextLine()}{wxtextfilegetnextline}.
and used by \helpref{GetFirstLine()}{wxtextfilegetfirstline}/\helpref{GetNextLine()}{wxtextfilegetnextline}.
\membersection{wxTextFile::Eof}\label{wxtextfileeof}
@@ -223,13 +223,13 @@ Insert a line before the line number {\it n}.
\constfunc{void}{RemoveLine}{\param{size\_t }{n}}
Delete one line from the file.
Delete line number {\it n} from the file.
\membersection{wxTextFile::Write}\label{wxtextfilewrite}
\constfunc{bool}{Write}{\param{wxTextFileType }{typeNew = wxTextFileType\_None}}
Change the file on disk. The {\it typeNew} parameter allows to change the
Change the file on disk. The {\it typeNew} parameter allows you to change the
file format (default argument means "don't change type") and may be used to
convert, for example, DOS files to Unix.

View File

@@ -1,11 +1,11 @@
\section{\class{wxThread}}\label{wxthread}
A thread is basically a path of execution through a program. Threads are also
sometimes calls {\it light-wight processes}, but the fundamental difference
sometimes called {\it light-weight processes}, but the fundamental difference
between threads and processes is that memory spaces of different processes are
separated while all threads share the same address space. While it makes it
much easier to share common data between several threads, it also makes much
easier to shoot oneself in a leg, so careful use of synchronization objects
easier to shoot oneself in the foot, so careful use of synchronization objects
such as \helpref{mutexes}{wxmutex} and/or \helpref{critical sections}{wxcriticalsection} is recommended.
\wxheading{Derived from}

View File

@@ -10,7 +10,7 @@ to give an application the chance to update various user interface elements.
\wxheading{Event table macros}
To process a menu event, use these event handler macros to direct input to member
To process an update event, use these event handler macros to direct input to member
functions that take a wxUpdateUIEvent argument.
\twocolwidtha{7cm}
@@ -36,6 +36,10 @@ Instead of directly manipulating the menu or button, you call functions in the e
object, such as \helpref{wxUpdateUIEvent::Check}{wxupdateuieventcheck}. wxWindows
will determine whether such a call has been made, and which UI element to update.
These events will work for popup menus as well as menubars. Just before a menu is popped
up, \helpref{wxMenu::UpdateUI}{wxmenuupdateui} is called to process any UI events for
the window that owns the menu.
\wxheading{See also}
\helpref{Event handling overview}{eventhandlingoverview}

View File

@@ -298,30 +298,6 @@ Enable or disable the window for user input.
\helpref{wxWindow::IsEnabled}{wxwindowisenabled}
\membersection{wxWindow::FakePopupMenu}\label{wxwindowfakepopupmenu}
\func{virtual bool}{FakePopupMenu}{\param{wxMenu* }{menu}, \param{int }{x}, \param{int }{y}}
A replacement for wxWindow::PopupMenu for cases where the PopupMenu implementation
does not work correctly, in particular on Motif platforms.
\wxheading{Parameters}
\docparam{menu}{Menu to pop up.}
\docparam{x}{Required x position for the menu to appear.}
\docparam{y}{Required y position for the menu to appear.}
\wxheading{Remarks}
This is a cut-down version of PopupMenu using a dialog and listbox; pull-right menus
are not supported.
\wxheading{See also}
\helpref{wxMenu}{wxmenu}, \helpref{wxWindow::PopupMenu}{wxwindowpopupmenu}
\membersection{wxWindow::FindFocus}\label{wxwindowfindfocus}
\func{static wxWindow*}{FindFocus}{\void}
@@ -1409,7 +1385,12 @@ the commandInt member of the event to check the selected menu identifier.
\wxheading{See also}
\helpref{wxMenu}{wxmenu}, \helpref{wxWindow::FakePopupMenu}{wxwindowfakepopupmenu}
\helpref{wxMenu}{wxmenu}
\wxheading{Remarks}
Just before the menu is popped up, \helpref{wxMenu::UpdateUI}{wxmenuupdateui} is called
to ensure that the menu items are in the correct state.
\membersection{wxWindow::PushEventHandler}\label{wxwindowpusheventhandler}

View File

@@ -197,6 +197,10 @@ WXDLLEXPORT void wxSplitPath(const char *pszFileName,
// find a file in a list of directories, returns false if not found
WXDLLEXPORT bool wxFindFileInPath(wxString *pStr, const char *pszPath, const char *pszFile);
// Get the OS directory if appropriate (such as the Windows directory).
// On non-Windows platform, probably just return the empty string.
WXDLLEXPORT wxString wxGetOSDirectory();
// ----------------------------------------------------------------------------
// classes
// ----------------------------------------------------------------------------

View File

@@ -128,6 +128,12 @@ public:
inline void SetClientData( void* clientData ) { m_clientData = clientData; }
inline void* GetClientData() const { return m_clientData; }
// Updates the UI for a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*) NULL);
// implementation
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;

View File

@@ -128,6 +128,12 @@ public:
inline void SetClientData( void* clientData ) { m_clientData = clientData; }
inline void* GetClientData() const { return m_clientData; }
// Updates the UI for a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*) NULL);
// implementation
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;

View File

@@ -85,6 +85,12 @@ public:
// Find wxMenuItem by ID, and item's menu too if itemMenu is !NULL.
wxMenuItem *FindItemForId(int itemId, wxMenu **itemMenu = NULL) const;
// Updates the UI for a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*) NULL);
void ProcessCommand(wxCommandEvent& event);
inline void Callback(const wxFunction func) { m_callback = func; }
@@ -94,6 +100,9 @@ public:
inline wxList& GetItems() const { return (wxList&) m_menuItems; }
void SetInvokingWindow(wxWindow *pWin) { m_pInvokingWindow = pWin; }
wxWindow *GetInvokingWindow() const { return m_pInvokingWindow; }
//// Motif-specific
inline WXWidget GetButtonWidget() const { return m_buttonWidget; }
inline void SetButtonWidget(WXWidget buttonWidget) { m_buttonWidget = buttonWidget; }
@@ -136,6 +145,7 @@ public:
wxEvtHandler * m_parent;
wxEvtHandler * m_eventHandler;
void* m_clientData;
wxWindow* m_pInvokingWindow;
//// Motif-specific
int m_numColumns;

View File

@@ -83,6 +83,12 @@ public:
// Find wxMenuItem by ID, and item's menu too if itemMenu is !NULL.
wxMenuItem *FindItemForId(int itemId, wxMenu **itemMenu = NULL) const;
// Updates the UI for a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*) NULL);
void ProcessCommand(wxCommandEvent& event);
inline void Callback(const wxFunction func) { m_callback = func; }

View File

@@ -66,6 +66,9 @@ public:
inline void SetClientData(void* clientData) { m_clientData = clientData; }
inline void* GetClientData() const { return m_clientData; }
void SetInvokingWindow(wxWindow *pWin) { m_pInvokingWindow = pWin; }
wxWindow *GetInvokingWindow() const { return m_pInvokingWindow; }
// item properties
// title
void SetTitle(const wxString& label);
@@ -86,6 +89,12 @@ public:
void ProcessCommand(wxCommandEvent& event);
inline void Callback(const wxFunction func) { m_callback = func; }
// Updates the UI for a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void UpdateUI(wxEvtHandler* source = (wxEvtHandler*) NULL);
virtual void SetParent(wxEvtHandler *parent) { m_parent = parent; }
inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
@@ -102,6 +111,7 @@ public:
wxEvtHandler * m_parent;
wxEvtHandler * m_eventHandler;
void* m_clientData;
wxWindow* m_pInvokingWindow;
};
// ----------------------------------------------------------------------------

View File

@@ -195,7 +195,7 @@ void wxDataOutputStream::WriteDouble(double d)
#if wxUSE_APPLE_IEEE
ConvertToIeeeExtended(d, (unsigned char *)buf);
#else
# pragma warning "wxDataStream::WriteDouble() not using IeeeExtended - will not work!"
# pragma warning "wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!"
buf[0] = '\0';
#endif
Write(buf, 10);

View File

@@ -1451,6 +1451,19 @@ bool wxSetWorkingDirectory(const wxString& d)
#endif
}
// Get the OS directory if appropriate (such as the Windows directory).
// On non-Windows platform, probably just return the empty string.
wxString wxGetOSDirectory()
{
#ifdef __WINDOWS__
char buf[256];
GetWindowsDirectory(buf, 256);
return wxString(buf);
#else
return wxEmptyString;
#endif
}
bool wxEndsWithPathSeparator(const char *pszFileName)
{
size_t len = Strlen(pszFileName);

View File

@@ -642,4 +642,44 @@ wxWindow *wxMenu::GetInvokingWindow()
return m_invokingWindow;
}
// Update a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void wxMenu::UpdateUI(wxEvtHandler* source)
{
if (!source && GetInvokingWindow())
source = GetInvokingWindow()->GetEventHandler();
if (!source)
source = GetEventHandler();
if (!source)
source = this;
wxNode* node = GetItems().First();
while (node)
{
wxMenuItem* item = (wxMenuItem*) node->Data();
if ( !item->IsSeparator() )
{
wxWindowID id = item->GetId();
wxUpdateUIEvent event(id);
event.SetEventObject( source );
if (source->ProcessEvent(event))
{
if (event.GetSetText())
SetLabel(id, event.GetText());
if (event.GetSetChecked())
Check(id, event.GetChecked());
if (event.GetSetEnabled())
Enable(id, event.GetEnabled());
}
if (item->GetSubMenu())
item->GetSubMenu()->UpdateUI(source);
}
node = node->Next();
}
}

View File

@@ -2727,6 +2727,8 @@ bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
SetInvokingWindow( menu, this );
menu->UpdateUI();
gs_pop_x = x;
gs_pop_y = y;

View File

@@ -642,4 +642,44 @@ wxWindow *wxMenu::GetInvokingWindow()
return m_invokingWindow;
}
// Update a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void wxMenu::UpdateUI(wxEvtHandler* source)
{
if (!source && GetInvokingWindow())
source = GetInvokingWindow()->GetEventHandler();
if (!source)
source = GetEventHandler();
if (!source)
source = this;
wxNode* node = GetItems().First();
while (node)
{
wxMenuItem* item = (wxMenuItem*) node->Data();
if ( !item->IsSeparator() )
{
wxWindowID id = item->GetId();
wxUpdateUIEvent event(id);
event.SetEventObject( source );
if (source->ProcessEvent(event))
{
if (event.GetSetText())
SetLabel(id, event.GetText());
if (event.GetSetChecked())
Check(id, event.GetChecked());
if (event.GetSetEnabled())
Enable(id, event.GetEnabled());
}
if (item->GetSubMenu())
item->GetSubMenu()->UpdateUI(source);
}
node = node->Next();
}
}

View File

@@ -2727,6 +2727,8 @@ bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
SetInvokingWindow( menu, this );
menu->UpdateUI();
gs_pop_x = x;
gs_pop_y = y;

View File

@@ -65,6 +65,7 @@ wxMenu::wxMenu(const wxString& title, const wxFunction func)
m_eventHandler = this;
m_noItems = 0;
m_menuBar = NULL;
m_pInvokingWindow = NULL;
//// Motif-specific members
m_numColumns = 1;
@@ -379,12 +380,50 @@ void wxMenu::ProcessCommand(wxCommandEvent & event)
{
processed = GetEventHandler()->ProcessEvent(event);
}
/* TODO
// Try the window the menu was popped up from (and up
// through the hierarchy)
if ( !processed && GetInvokingWindow())
processed = GetInvokingWindow()->ProcessEvent(event);
*/
}
// Update a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void wxMenu::UpdateUI(wxEvtHandler* source)
{
if (!source && GetInvokingWindow())
source = GetInvokingWindow()->GetEventHandler();
if (!source)
source = GetEventHandler();
if (!source)
source = this;
wxNode* node = GetItems().First();
while (node)
{
wxMenuItem* item = (wxMenuItem*) node->Data();
if ( !item->IsSeparator() )
{
wxWindowID id = item->GetId();
wxUpdateUIEvent event(id);
event.SetEventObject( source );
if (source->ProcessEvent(event))
{
if (event.GetSetText())
SetLabel(id, event.GetText());
if (event.GetSetChecked())
Check(id, event.GetChecked());
if (event.GetSetEnabled())
Enable(id, event.GetEnabled());
}
if (item->GetSubMenu())
item->GetSubMenu()->UpdateUI(source);
}
node = node->Next();
}
}
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
@@ -409,6 +448,10 @@ bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
menu->SetId(1); /* Mark as popped-up */
menu->CreateMenu(NULL, widget, menu);
menu->SetInvokingWindow(this);
menu->UpdateUI();
// menu->SetParent(parent);
// parent->children->Append(menu); // Store menu for later deletion

View File

@@ -519,6 +519,7 @@ extern wxMenu *wxCurrentPopupMenu;
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
{
menu->SetInvokingWindow(this);
menu->UpdateUI();
HWND hWnd = (HWND) GetHWND();
HMENU hMenu = (HMENU)menu->m_hMenu;
@@ -945,3 +946,42 @@ WXHMENU wxMenu::GetHMenu() const
return 0;
}
// Update a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void wxMenu::UpdateUI(wxEvtHandler* source)
{
if (!source && GetInvokingWindow())
source = GetInvokingWindow()->GetEventHandler();
if (!source)
source = GetEventHandler();
if (!source)
source = this;
wxNode* node = GetItems().First();
while (node)
{
wxMenuItem* item = (wxMenuItem*) node->Data();
if ( !item->IsSeparator() )
{
wxWindowID id = item->GetId();
wxUpdateUIEvent event(id);
event.SetEventObject( source );
if (source->ProcessEvent(event))
{
if (event.GetSetText())
SetLabel(id, event.GetText());
if (event.GetSetChecked())
Check(id, event.GetChecked());
if (event.GetSetEnabled())
Enable(id, event.GetEnabled());
}
if (item->GetSubMenu())
item->GetSubMenu()->UpdateUI(source);
}
node = node->Next();
}
}

View File

@@ -75,6 +75,7 @@
#include <stdarg.h>
//// BEGIN for console support: VC++ only
#ifdef __VISUALC__
#include "wx/msw/msvcrt.h"
@@ -103,6 +104,8 @@
# define new new(__FILE__,__LINE__)
# endif
#endif
// __VISUALC__
/// END for console support
// In the WIN.INI file

View File

@@ -303,8 +303,51 @@ void wxMenu::ProcessCommand(wxCommandEvent & event)
*/
}
// Update a menu and all submenus recursively.
// source is the object that has the update event handlers
// defined for it. If NULL, the menu or associated window
// will be used.
void wxMenu::UpdateUI(wxEvtHandler* source)
{
if (!source && GetInvokingWindow())
source = GetInvokingWindow()->GetEventHandler();
if (!source)
source = GetEventHandler();
if (!source)
source = this;
wxNode* node = GetItems().First();
while (node)
{
wxMenuItem* item = (wxMenuItem*) node->Data();
if ( !item->IsSeparator() )
{
wxWindowID id = item->GetId();
wxUpdateUIEvent event(id);
event.SetEventObject( source );
if (source->ProcessEvent(event))
{
if (event.GetSetText())
SetLabel(id, event.GetText());
if (event.GetSetChecked())
Check(id, event.GetChecked());
if (event.GetSetEnabled())
Enable(id, event.GetEnabled());
}
if (item->GetSubMenu())
item->GetSubMenu()->UpdateUI(source);
}
node = node->Next();
}
}
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
{
menu->SetInvokingWindow(this);
menu->UpdateUI();
// TODO
return FALSE;
}

View File

@@ -54,10 +54,6 @@
#include <strstream>
#endif
#ifdef __WXMSW__
#include <windows.h>
#endif
#ifdef __WXMSW__
#include "wx/help.h"
#endif
@@ -152,12 +148,13 @@ wxResourceManager::~wxResourceManager()
bool wxResourceManager::Initialize()
{
// Set up the resource filename for each platform.
// TODO: This shold be replaced by wxConfig usage.
#ifdef __WXMSW__
// dialoged.ini in the Windows directory
char buf[256];
GetWindowsDirectory(buf, 256);
strcat(buf, "\\dialoged.ini");
m_optionsResourceFilename = buf;
wxString windowsDir = wxGetOSDirectory();
windowsDir += "\\dialoged.ini" ;
m_optionsResourceFilename = windowsDir;
#elif defined(__WXGTK__) || defined(__WXMOTIF__)
wxGetHomeDir( &m_optionsResourceFilename );
m_optionsResourceFilename += "/.dialogedrc";

View File

@@ -19,7 +19,7 @@
#include <wx/metafile.h>
#ifndef __WXMSW__
#ifndef GetRValue
#define GetRValue(rgb) ((unsigned char)(rgb))
#define GetGValue(rgb) ((unsigned char)(((int)(rgb)) >> 8))
#define GetBValue(rgb) ((unsigned char)((rgb)>>16))
@@ -27,7 +27,7 @@
/* Metafile Functions */
/* Win32s/Borland need these macros, although META_SETBKCOLOR is defined */
#if !defined(META_SETBKCOLOR) || defined(WIN32)
#if !defined(META_SETBKCOLOR) // || defined(WIN32)
#define META_SETBKCOLOR 0x0201
#define META_SETBKMODE 0x0102
@@ -129,7 +129,7 @@
/* PitchAndFamily family values (high 4 bits) */
/* Win32s/Borland don't need this */
#if !defined(__BORLANDC__) && !defined(WIN32)
#ifndef FF_DONTCARE // !defined(__BORLANDC__) && !defined(WIN32)
#define FF_DONTCARE 0x00
#define FF_ROMAN 0x10
#define FF_SWISS 0x20