class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
class MatrixSymbol { wxPoint m_Position; wxChar m_Symbol; int m_Speed; wxColour m_Colour; public : MatrixSymbol() : m_Position(wxDefaultPosition), m_Symbol(wxT( '0' )), m_Speed(1), m_Colour(*wxGREEN) {} MatrixSymbol( const wxPoint & position, wxChar symbol, int speed, const wxColour & colour) : m_Position(position), m_Symbol(symbol), m_Speed(speed), m_Colour(colour) {} const wxPoint & GetPosition() { return m_Position;} void SetPosition( const wxPoint & value ) {m_Position = value ;} wxChar GetSymbol() { return m_Symbol;} void SetSymbol(wxChar value ) {m_Symbol = value ;} int GetSpeed() { return m_Speed;} void SetSpeed( int value ) {m_Speed = value ;} const wxColour & GetColour() { return m_Colour;} void SetColour( const wxColour & value ) {m_Colour = value ;} }; * This source code was highlighted with Source Code Highlighter .
* This source code was highlighted with Source Code Highlighter .
- #include <wx / dynarray.h>
- ...
- WX_DECLARE_OBJARRAY (MatrixSymbol, MatrixSymbolArray);
- ...
- #include <wx / arrimpl.cpp>
- WX_DEFINE_OBJARRAY (MatrixSymbolArray);
wxWindow
, and add in it as a member variable of the class an array of MatrixSymbol
objects, as well as a method initializing this array with values:* This source code was highlighted with Source Code Highlighter .
- class MatrixCanvas: public wxWindow
- {
- ...
- void InitMatrix ();
- ...
- MatrixSymbolArray m_Symbols;
- ...
- };
- void MatrixCanvas :: InitMatrix ()
- {
- int width (0), height (0);
- int sw (0), sh (0);
- GetTextExtent (wxT ( "0" ), & sw, & sh);
- GetClientSize (& width, & height);
- m_Symbols.Clear ();
- for ( int x = 0; x <width; x + = sw + 2)
- {
- m_Symbols.Add (MatrixSymbol (
- wxPoint (x, 0),
- rand ()% 2? wxT ( '0' ): wxT ( '1' ),
- 3 + rand ()% 5,
- wxColour (0, rand ()% 200 + 56, 0)));
- }
- }
InitMatrix()
method InitMatrix()
? Depending on the size of the client area of ββthe component, a number of MatrixSymbol
objects are MatrixSymbol
with random coordinates, displayed as β0β or β1β, and in different colors (random green gradation is selected).wxEVT_PAINT
and wxEVT_ERASE_BACKGROUND
.* This source code was highlighted with Source Code Highlighter .
- BEGIN_EVENT_TABLE (MatrixCanvas, wxWindow)
- EVT_PAINT (MatrixCanvas :: OnPaint)
- EVT_ERASE_BACKGROUND (MatrixCanvas :: OnEraseBackground)
- END_EVENT_TABLE ()
- void MatrixCanvas :: OnPaint (wxPaintEvent & event )
- {
- wxBufferedPaintDC dc ( this );
- dc.SetBackground (wxBrush (GetBackgroundColour ()));
- dc.Clear ();
- wxFont font = GetFont ();
- #if defined (__ WXWINCE__)
- int fontSize = 14;
- #else
- int fontSize = 48;
- #endif
- font.SetPointSize (fontSize);
- dc.SetFont (font);
- dc.SetTextForeground (wxColour (00, 20, 00));
- dc.DrawLabel (wxT ( "http://wxwidgets.info" ),
- wxRect (0, 0, dc.GetSize (). GetWidth (), dc.GetSize (). GetHeight ()),
- wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL);
- dc.SetFont (GetFont ());
- for (size_t i = 0; i <m_Symbols.Count (); i ++)
- {
- dc.SetTextForeground (m_Symbols [i] .GetColour ());
- dc.DrawText (wxString :: Format (wxT ( "% c" ), m_Symbols [i] .GetSymbol ()),
- m_Symbols [i] .GetPosition ());
- }
- }
- void MatrixCanvas :: OnEraseBackground (wxEraseEvent & event )
- {
- }
wxEVT_ERASE_BACKGROUND
event wxEVT_ERASE_BACKGROUND
empty (without calling event.Skip()
). This will provide us with a redraw component without flicker.wxEVT_PAINT
event wxEVT_PAINT
, we create a device context, set the background color to the background color of our component, then clean up (this is equivalent to filling with color). After that, an inscription is drawn in the center of the component, and then in the loop, all symbols from the array are drawn.wxEVT_SIZE
so that when the component is resized, the characters are displayed across the entire width. In the handler, we will simply call the InitMatrix()
method, which fills the array with characters.* This source code was highlighted with Source Code Highlighter .
- BEGIN_EVENT_TABLE (MatrixCanvas, wxWindow)
- ...
- EVT_SIZE (MatrixCanvas :: OnSize)
- END_EVENT_TABLE ()
- ...
- void MatrixCanvas :: OnSize (wxSizeEvent & event )
- {
- InitMatrix ();
- Refresh ();
- }
* This source code was highlighted with Source Code Highlighter .
- class MatrixCanvas: public wxWindow
- {
- ...
- wxTimer * m_MovementTimer;
- };
- MatrixCanvas :: MatrixCanvas (wxWindow * parent, wxWindowID id, const wxPoint & pos, const wxSize & size, long style)
- {
- Init ();
- Create (parent, id, pos, size, style);
- }
- bool MatrixCanvas :: Create (wxWindow * parent, wxWindowID id, const wxPoint & pos, const wxSize & size, long style)
- {
- wxWindow :: Create (parent, id, pos, size, style);
- CreateControls ();
- return true ;
- }
- MatrixCanvas :: ~ MatrixCanvas ()
- {
- wxDELETE (m_MovementTimer);
- }
- void MatrixCanvas :: Init ()
- {
- m_PreviewMode = false ;
- }
- void MatrixCanvas :: CreateControls ()
- {
- this -> SetForegroundColour (wxColour (0, 255, 0));
- this -> SetBackgroundColour (wxColour (0, 0, 0));
- int timerID = wxNewId ();
- m_MovementTimer = new wxTimer ( this , timerID);
- Connect (timerID, wxEVT_TIMER,
- wxTimerEventHandler (MatrixCanvas :: OnMovementTimer));
- InitMatrix ();
- Refresh ();
- m_MovementTimer-> Start (30);
- }
- void MatrixCanvas :: OnMovementTimer (wxTimerEvent & event )
- {
- for (size_t i = 0; i <m_Symbols.Count (); i ++)
- {
- int y = m_Symbols [i] .GetPosition (). y + m_Symbols [i] .GetSpeed ββ();
- if (y> GetClientSize (). GetHeight ())
- {
- y = -20;
- m_Symbols [i] .SetSpeed ββ(3 + rand ()% 5);
- m_Symbols [i] .SetColour (wxColour (0, rand ()% 200 + 56, 0));
- m_Symbols [i] .SetSymbol (rand ()% 2? wxT ( '0' ): wxT ( '1' ));
- }
- m_Symbols [i] .SetPosition (wxPoint (
- m_Symbols [i] .GetPosition (). x, y));
- }
- Refresh ();
- }
CreateControls()
method and an event handler is assigned to it using the Connect()
method. In the destructor, the timer is deleted.bool m_PreviewMode
class and, depending on its value, in the event handlers for keystrokes and mouse clicks, we will close the main form of the application.* This source code was highlighted with Source Code Highlighter .
- void MatrixCanvas :: OnMouse (wxMouseEvent & event )
- {
- if ( event .LeftDown () || event .MiddleDown () || event .RightDown ())
- {
- if (! m_PreviewMode)
- {
- wxFrame * frame = wxDynamicCast (wxTheApp-> GetTopWindow (), wxFrame);
- if (frame) frame-> Close ();
- }
- }
- }
- void MatrixCanvas :: OnChar (wxKeyEvent & event )
- {
- if (! m_PreviewMode)
- {
- wxFrame * frame = wxDynamicCast (wxTheApp-> GetTopWindow (), wxFrame);
- if (frame) frame-> Close ();
- }
- }
* This source code was highlighted with Source Code Highlighter .
- void MatrixEffectMainFrame :: CreateControls ()
- {
- MatrixEffectMainFrame * itemFrame1 = this ;
- wxBoxSizer * itemBoxSizer2 = new wxBoxSizer (wxVERTICAL);
- itemFrame1-> SetSizer (itemBoxSizer2);
- m_Canvas = new MatrixCanvas (itemFrame1, ID_CANVAS, wxDefaultPosition, wxSize (100, 100), wxNO_BORDER);
- itemBoxSizer2-> Add (m_Canvas, 1, wxGROW, 0);
- }
wxCmdLineParser
class for handling command line arguments in wxWidgets. We will use it.* This source code was highlighted with Source Code Highlighter .
- bool wxMatrixEffectApp :: OnInit ()
- {
- #if defined (__ WXMSW__) &&! defined (__ WXWINCE__)
- wxCmdLineParser parser (argc, argv);
- parser.AddSwitch (wxT ( "S" ), wxEmptyString,
- wxEmptyString, wxCMD_LINE_PARAM_OPTIONAL);
- parser.AddSwitch (wxT ( "s" ), wxEmptyString,
- wxEmptyString, wxCMD_LINE_PARAM_OPTIONAL);
- parser.AddOption (wxT ( "c" ), wxEmptyString,
- wxEmptyString, wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL);
- parser.AddOption (wxT ( "p" ), wxEmptyString,
- wxEmptyString, wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL);
- if (parser.Parse ( false ) == 0)
- {
- long parentHWND (0);
- if (parser.Found (wxT ( "S" )) || parser.Found (wxT ( "s" )))
- {
- MatrixEffectMainFrame * mainWindow =
- new MatrixEffectMainFrame (NULL);
- mainWindow-> ShowFullScreen ( true );
- return true ;
- }
- else if (parser.Found (wxT ( "c" )))
- {
- wxMessageBox (
- _ ( "No settings for this screensaver. For more information visit wxwidgets.info" ));
- return false ;
- }
- else if (parser.Found (wxT ( "p" ), & parentHWND))
- {
- wxWindow * parent = new wxWindow;
- parent-> SetHWND ((HWND) parentHWND);
- RECT r;
- GetWindowRect ((HWND) parent-> GetHWND (), & r);
- MatrixCanvas * mainWindow = new MatrixCanvas (
- parent, ID_MATRIXEFFECTMAINFRAME,
- wxPoint (0,0), wxSize (r.right-r.left, r.bottom-r.top),
- wxNO_BORDER);
- mainWindow-> SetPreviewMode ( true );
- SetTopWindow (mainWindow);
- mainWindow-> Show ( true );
- return true ;
- }
- }
- return false ;
- #else
- MatrixEffectMainFrame * mainWindow =
- new MatrixEffectMainFrame (NULL);
- SetTopWindow (mainWindow);
- #if defined (__ WXWINCE__)
- mainWindow-> Show ( true );
- #else
- mainWindow-> ShowFullScreen ( true );
- #endif
- return true ;
- #endif
- }
OnInit()
method of the application class, we create a wxCmdLineParser
object, add descriptions of all possible parameters:wxCmdLineParser
object, the Parse()
method is called, which checks the command line for the specified settings.wxWindow
from the window handle:wxWindow * parent = new wxWindow;
parent->SetHWND((HWND)parentHWND);
Source: https://habr.com/ru/post/48046/
All Articles