Back to index

libsfml  1.6+dfsg2
Public Member Functions | Private Member Functions
wxSFMLCanvas Class Reference

wxSFMLCanvas allows to run SFML in a wxWidgets control ///////////////////////////////////////////////////////// More...

#include <wxSFMLCanvas.hpp>

Inheritance diagram for wxSFMLCanvas:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 wxSFMLCanvas (wxWindow *Parent=NULL, wxWindowID Id=-1, const wxPoint &Position=wxDefaultPosition, const wxSize &Size=wxDefaultSize, long Style=0)
 Construct the wxSFMLCanvas.
virtual ~wxSFMLCanvas ()
 Destructor.

Private Member Functions

virtual void OnUpdate ()
 Notification for the derived class that moment is good for doing its update and drawing stuff.
void OnIdle (wxIdleEvent &)
 Called when the window is idle - we can refresh our SFML window.
void OnPaint (wxPaintEvent &)
 Called when the window is repainted - we can display our SFML window.
void OnEraseBackground (wxEraseEvent &)
 Called when the window needs to draw its background.

Detailed Description

wxSFMLCanvas allows to run SFML in a wxWidgets control /////////////////////////////////////////////////////////

Definition at line 15 of file wxSFMLCanvas.hpp.


Constructor & Destructor Documentation

wxSFMLCanvas::wxSFMLCanvas ( wxWindow *  Parent = NULL,
wxWindowID  Id = -1,
const wxPoint &  Position = wxDefaultPosition,
const wxSize &  Size = wxDefaultSize,
long  Style = 0 
)

Construct the wxSFMLCanvas.

Construct the wxSFMLCanvas /////////////////////////////////////////////////////////.

Parameters:
Parent: Parent of the control (NULL by default)
Id: Identifier of the control (-1 by default)
Position: Position of the control (wxDefaultPosition by default)
Size: Size of the control (wxDefaultSize by default)
Style: Style of the control (0 by default)

/////////////////////////////////////////////////////////

Definition at line 29 of file wxSFMLCanvas.cpp.

                                                                                                                   :
wxControl(Parent, Id, Position, Size, Style)
{
    #ifdef __WXGTK__

        // GTK implementation requires to go deeper to find the low-level X11 identifier of the widget
        gtk_widget_realize(m_wxwindow);
        gtk_widget_set_double_buffered(m_wxwindow, false);
        GdkWindow* Win = GTK_PIZZA(m_wxwindow)->bin_window;
        XFlush(GDK_WINDOW_XDISPLAY(Win));
        sf::RenderWindow::Create(GDK_WINDOW_XWINDOW(Win));

    #else

        // Tested under Windows XP only (should work with X11 and other Windows versions - no idea about MacOS)
        sf::RenderWindow::Create(GetHandle());
    
    #endif
}

Destructor.

Destructor /////////////////////////////////////////////////////////.

/////////////////////////////////////////////////////////

Definition at line 53 of file wxSFMLCanvas.cpp.

{
    // Nothing to do...
}

Member Function Documentation

void wxSFMLCanvas::OnEraseBackground ( wxEraseEvent &  ) [private]

Called when the window needs to draw its background.

Called when the control needs to draw its background /////////////////////////////////////////////////////////.

/////////////////////////////////////////////////////////

Definition at line 100 of file wxSFMLCanvas.cpp.

{
    // Don't do anything. We intercept this event in order to prevent the
    // parent class to draw the background before repainting the window,
    // which would cause some flickering
}
void wxSFMLCanvas::OnIdle ( wxIdleEvent &  ) [private]

Called when the window is idle - we can refresh our SFML window.

Called when the control is idle - we can refresh our SFML window /////////////////////////////////////////////////////////.

/////////////////////////////////////////////////////////

Definition at line 73 of file wxSFMLCanvas.cpp.

{
    // Send a paint message when the control is idle, to ensure maximum framerate
    Refresh();
}
void wxSFMLCanvas::OnPaint ( wxPaintEvent &  ) [private]

Called when the window is repainted - we can display our SFML window.

Called when the control is repainted - we can display our SFML window /////////////////////////////////////////////////////////.

/////////////////////////////////////////////////////////

Definition at line 84 of file wxSFMLCanvas.cpp.

{
    // Make sure the control is able to be repainted
    wxPaintDC Dc(this);

    // Let the derived class do its specific stuff
    OnUpdate();

    // Display on screen
    Display();
}

Here is the call graph for this function:

void wxSFMLCanvas::OnUpdate ( ) [private, virtual]

Notification for the derived class that moment is good for doing its update and drawing stuff.

Notification for the derived class that moment is good for doing its update and drawing stuff /////////////////////////////////////////////////////////.

/////////////////////////////////////////////////////////

Reimplemented in MyCanvas, and MyCanvas.

Definition at line 63 of file wxSFMLCanvas.cpp.

{
    // Nothing to do by default...
}

Here is the caller graph for this function:


The documentation for this class was generated from the following files: