svn software and patches

olivier.corrio at gmail.com olivier.corrio at gmail.com
Sat Apr 5 07:02:27 PDT 2008



Hi,
On X11 system window creation is made later, so it is not possible at
beginning to have size and to modify it just after software creation.
We have to wait for the CreateEvent

1/ First problem : here is the code to make SetShape works (sample
code).In the code there is a #ifdef __WXGTK
So there are two choices, to modify the sample and create the shape by
receiving wxWindowCreateEvent for all platforms to have something more
to the way of thinking of "just one code for allp latforms without
modifications".The idea is just to store a m_shape_region in class
wxTopLevelWindowGTK and to call again SetShape when the frame is
realized.

BEGIN_EVENT_TABLE(ShapedFrame, wxFrame)
...
#ifdef __WXGTK__
    EVT_WINDOW_CREATE(ShapedFrame::OnWindowCreate)
#endif
END_EVENT_TABLE()

ShapedFrame::ShapedFrame(wxFrame *parent)
       : wxFrame(parent, wxID_ANY, wxEmptyString,
                  wxDefaultPosition, wxSize(100, 100),
                  0
                  | wxFRAME_SHAPED
                  | wxSIMPLE_BORDER
                  | wxFRAME_NO_TASKBAR
                  | wxSTAY_ON_TOP
            )
{
    m_hasShape = false;
    m_bmp = wxBitmap(_T("star.png"), wxBITMAP_TYPE_PNG);
    SetSize(wxSize(m_bmp.GetWidth(), m_bmp.GetHeight()));
    SetToolTip(wxT("Right-click to close"));

#ifndef __WXGTK__
    // On wxGTK we can't do this yet because the window hasn't been
created
    // yet so we wait until the EVT_WINDOW_CREATE event happens.  On
wxMSW and
    // wxMac the window has been created at this point so we go ahead
and set
    // the shape now.
    SetWindowShape();
#endif
}

2/ Second problem is the same, so my idea is to try to anticipate as
Qt does (but i look ath svn trunk before doing something)

3/ After looking at event.h it is an errordon't worry

Sincerely


More information about the wx-users mailing list