Example #1
0
BOOL CInventoryBox::net_Spawn(CSE_Abstract* DC)
{
	inherited::net_Spawn	(DC);
	setVisible				(TRUE);
	setEnabled				(TRUE);
	set_tip_text			("inventory_box_use");

	return					TRUE;
}
html_tip_dialog::html_tip_dialog( wxWindow* parent,
                                  wxTipProvider* tip_provider,
                                  bool show_at_startup,
                                  const wxString& header_html,
                                  const wxString& footer_html,  
                                  bool use_system_style,                   
                                  wxSize html_window_size,
                                  int html_window_content_padding,
                                  const wxString& title
                                )  
           : wxDialog( parent, -1, title, wxDefaultPosition, wxDefaultSize,
                      wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{
    m_tip_provider  = tip_provider;
    m_header_html   = header_html;
    m_footer_html   = footer_html;
    m_use_system_style = use_system_style;

    // Create controls in tab order.

    wxButton* close_button = new wxButton( this, wxID_CANCEL, _( "&Close" ) );

    m_checkbox = new wxCheckBox( this, -1, _( "&Show tips at startup" ) );
    m_checkbox->SetValue( show_at_startup );

    wxButton* next_button = new wxButton( this, ID_NEXT_TIP_BUTTON, _( "&Next Tip" ) );

    // Create a html window.
    m_html_window = new wxHtmlWindow( this, -1, wxDefaultPosition, html_window_size );

    // If the paramater for the internal padding, is not -1 (or any negative),
    // then set it to the desired value.
    // Otherwise just leave it at the wxHtmlWindow default (which looks to be about 
    // 10 or so).
    if ( -1 < html_window_content_padding )
    {
        m_html_window->SetBorders( html_window_content_padding );
    }
    
    // Make a box vertical sizer to hald the html window and another vertical boxsizer
    wxBoxSizer* root_boxsizer = new wxBoxSizer( wxVERTICAL );
    
    // Add html window to boxsizer
    root_boxsizer->Add( m_html_window, 1, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 10 );

    // Make a horizontal boxsizer for the controls at the bottom...
    wxBoxSizer* controls_boxsizer = new wxBoxSizer( wxHORIZONTAL );  
    // ...and then add the bottom controls to this controls boxsizer.
    controls_boxsizer->Add( m_checkbox, 0, wxCENTER );
    controls_boxsizer->Add( 10,10,1 );
    controls_boxsizer->Add( next_button, 0, wxCENTER | wxLEFT, 10 );
    controls_boxsizer->Add( close_button, 0, wxCENTER | wxLEFT, 10 );
    
    // Add the controls boxsizer to the root boxsizer.
    root_boxsizer->Add( controls_boxsizer, 0, wxEXPAND | wxALL, 10 );

    // Set the first tip.
    set_tip_text();

    // Do the standard sizer fitting stuff.
    SetAutoLayout( TRUE );
    SetSizer( root_boxsizer );
    root_boxsizer->SetSizeHints( this );
    root_boxsizer->Fit( this );

    // Center the html tip dialog on its parent.
    Centre( wxBOTH | wxCENTER_FRAME );
    
}
void html_tip_dialog::on_next_tip_button( wxCommandEvent& WXUNUSED( event ) )
{
    set_tip_text();
}