Exemple #1
0
void wxFrame::SetToolBar(wxToolBar *toolbar)
{
    bool hadTbar = m_frameToolBar != NULL;

    wxFrameBase::SetToolBar(toolbar);

    if ( m_frameToolBar )
    {
        // insert into toolbar area if not already there
        if ((m_frameToolBar->m_widget->parent) &&
            (m_frameToolBar->m_widget->parent != m_mainWidget))
        {
            GetChildren().DeleteObject( m_frameToolBar );

            gtk_widget_reparent( m_frameToolBar->m_widget, m_mainWidget );
            GtkUpdateSize();
        }
    }
    else // toolbar unset
    {
        // still need to update size if it had been there before
        if ( hadTbar )
        {
            GtkUpdateSize();
        }
    }
}
Exemple #2
0
void wxFrame::PositionStatusBar()
{
    if ( !m_frameStatusBar )
        return;

    GtkUpdateSize();
}
Exemple #3
0
void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
{
    wxFrameBase::AttachMenuBar(menuBar);

    if (m_frameMenuBar)
    {
        m_frameMenuBar->SetParent(this);
        gtk_pizza_put( GTK_PIZZA(m_mainWidget),
                m_frameMenuBar->m_widget,
                m_frameMenuBar->m_x,
                m_frameMenuBar->m_y,
                m_frameMenuBar->m_width,
                m_frameMenuBar->m_height );

        if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
        {
            gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
                GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );

            gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
                GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
        }

        gtk_widget_show( m_frameMenuBar->m_widget );

        UpdateMenuBarSize();
    }
    else
    {
        m_menuBarHeight = 2;
        GtkUpdateSize();        // resize window in OnInternalIdle
    }
}
Exemple #4
0
void wxFrame::SetStatusBar(wxStatusBar *statbar)
{
    bool hadStatBar = m_frameStatusBar != NULL;

    wxFrameBase::SetStatusBar(statbar);

    if (hadStatBar && !m_frameStatusBar)
        GtkUpdateSize();
}
Exemple #5
0
wxStatusBar* wxFrame::CreateStatusBar(int number,
                                      long style,
                                      wxWindowID id,
                                      const wxString& name)
{
    wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );

    // because it will change when toolbar is added
    GtkUpdateSize();

    return wxFrameBase::CreateStatusBar( number, style, id, name );
}
Exemple #6
0
wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& name )
{
    wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );

    m_insertInClientArea = false;

    m_frameToolBar = wxFrameBase::CreateToolBar( style, id, name );

    m_insertInClientArea = true;

    GtkUpdateSize();

    return m_frameToolBar;
}
Exemple #7
0
void wxFrame::UpdateMenuBarSize()
{
    GtkRequisition  req;

    req.width = 2;
    req.height = 2;

    // this is called after Remove with a NULL m_frameMenuBar
    if ( m_frameMenuBar )
        (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_frameMenuBar->m_widget) )->size_request )
            (m_frameMenuBar->m_widget, &req );

    m_menuBarHeight = req.height;

    // resize window in OnInternalIdle

    GtkUpdateSize();
}
Exemple #8
0
void wxFrame::UpdateMenuBarSize()
{
    m_menuBarHeight = 2;

    // this is called after Remove with a NULL m_frameMenuBar
    if ( m_frameMenuBar )
    {
        GtkRequisition req;
        gtk_widget_ensure_style(m_frameMenuBar->m_widget);
        // have to call class method directly because
        // "size_request" signal is overridden by wx
        GTK_WIDGET_GET_CLASS(m_frameMenuBar->m_widget)->size_request(
            m_frameMenuBar->m_widget, &req);

        m_menuBarHeight = req.height;
    }

    // resize window in OnInternalIdle
    GtkUpdateSize();
}
Exemple #9
0
void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
{
    wxFrameBase::AttachMenuBar(menuBar);

    if (m_frameMenuBar)
    {
        m_frameMenuBar->SetInvokingWindow( this );

        m_frameMenuBar->SetParent(this);
        gtk_pizza_put( GTK_PIZZA(m_mainWidget),
                m_frameMenuBar->m_widget,
                m_frameMenuBar->m_x,
                m_frameMenuBar->m_y,
                m_frameMenuBar->m_width,
                m_frameMenuBar->m_height );

        if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
        {
            g_signal_connect (menuBar->m_widget, "child_attached",
                              G_CALLBACK (gtk_menu_attached_callback),
                              this);
            g_signal_connect (menuBar->m_widget, "child_detached",
                              G_CALLBACK (gtk_menu_detached_callback),
                              this);
        }

        gtk_widget_show( m_frameMenuBar->m_widget );

        UpdateMenuBarSize();

        g_signal_connect(menuBar->m_widget, "style-set",
            G_CALLBACK(menubar_style_set), this);
    }
    else
    {
        m_menuBarHeight = 2;
        GtkUpdateSize();        // resize window in OnInternalIdle
    }
}