コード例 #1
0
ファイル: mediactrlcmn.cpp プロジェクト: gitrider/wxsj2
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
                         const wxURI& location,
                         const wxPoint& pos,
                         const wxSize& size,
                         long style,
                         const wxString& szBackend,
                         const wxValidator& validator,
                         const wxString& name)
{
    if(!szBackend.empty())
    {
        wxClassInfo* pClassInfo = wxClassInfo::FindClass(szBackend);
        if(!pClassInfo || !DoCreate(pClassInfo, parent, id,
                                    pos, size, style, validator, name))
        {
            m_imp = NULL;
            return false;
        }

        if (!Load(location))
        {
            delete m_imp;
            m_imp = NULL;
            return false;
        }

        SetBestFittingSize(size);
        return true;
    }
    else
    {
        wxClassInfo::sm_classTable->BeginFind();

        wxClassInfo* classInfo;

        while((classInfo = NextBackend()) != NULL)
        {
            if(!DoCreate(classInfo, parent, id,
                         pos, size, style, validator, name))
                continue;

            if (Load(location))
            {
                SetBestFittingSize(size);
                return true;
            }
            else
                delete m_imp;
        }

        m_imp = NULL;
        return false;
    }
}
コード例 #2
0
ファイル: ToolBar.cpp プロジェクト: ruthmagnus/audacity
void ToolBar::ReCreateButtons()
{
   // SetSizer(NULL) detaches mHSizer and deletes it.
   // Do not use Detach() here, as that attempts to detach mHSizer from itself!
   SetSizer( NULL );

   // Get rid of any children we may have
   DestroyChildren();

   // Create the main sizer
   wxBoxSizer *ms = new wxBoxSizer( wxHORIZONTAL );

   // Create the grabber and add it to the main sizer
   mGrabber = new Grabber( this, mType );
   ms->Add( mGrabber, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_TOP | wxRIGHT, 1 );

   // Use a box sizer for laying out controls
   mHSizer = new wxBoxSizer( wxHORIZONTAL );
   ms->Add( mHSizer, 1, wxEXPAND );

   // (Re)Establish dock state
   SetDocked( IsDocked(), false );

   // Go add all the rest of the gadgets
   Populate();

   // Add some space for the resize border
   if( IsResizable() )
   {
      mSpacer = ms->Add( RWIDTH, 1 );
   }

   // Set the sizer and do initial layout
   SetSizerAndFit( ms );
   Layout();

   // Recalculate the height to be a multiple of toolbarSingle
#define tbs ( toolbarSingle + toolbarGap )
   wxSize sz = GetSize();
   sz.y = ( ( ( sz.y + tbs ) / tbs ) * tbs ) - 1;
#undef tbs

   // Set the true AND minimum sizes and do final layout
   SetBestFittingSize(sz);
   Layout();
}
コード例 #3
0
ファイル: misc_dialog.cpp プロジェクト: sirjuddington/SLumpEd
GfxOffsetDialog::GfxOffsetDialog(wxWindow *parent)
:	wxDialog(parent, -1, _T("Modify Gfx Offset(s)"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
{
	wxBoxSizer *m_vbox = new wxBoxSizer(wxVERTICAL);
	SetSizer(m_vbox);

	wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
	m_vbox->Add(hbox, 0, wxEXPAND|wxALL, 4);

	opt_set = new wxRadioButton(this, GOD_OPT_SET, _T("Set Offsets"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
	hbox->Add(opt_set, 1, wxEXPAND|wxALL, 4);

	entry_xoff = new wxTextCtrl(this, -1, _T(""), wxDefaultPosition, wxSize(40, -1));
	entry_yoff = new wxTextCtrl(this, -2, _T(""), wxDefaultPosition, wxSize(40, -1));
	cbox_relative = new wxCheckBox(this, -1, _T("Relative"));
	hbox->Add(entry_xoff, 0, wxEXPAND|wxALL, 4);
	hbox->Add(entry_yoff, 0, wxEXPAND|wxALL, 4);
	hbox->Add(cbox_relative, 0, wxEXPAND|wxALL, 4);

	hbox = new wxBoxSizer(wxHORIZONTAL);
	m_vbox->Add(hbox, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 4);

	opt_auto = new wxRadioButton(this, GOD_OPT_AUTO, _T("Automatic Offsets"));
	hbox->Add(opt_auto, 1, wxEXPAND|wxALL, 4);

	string offtypes[] =
	{
		_T("Monster"),
		_T("Projectile"),
		_T("Hud/Weapon")
	};

	combo_aligntype = new wxChoice(this, -1, wxDefaultPosition, wxDefaultSize, 3, offtypes);
	combo_aligntype->Select(0);
	combo_aligntype->Enable(false);
	hbox->Add(combo_aligntype, 0, wxEXPAND|wxALL, 4);

	m_vbox->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxEXPAND|wxALL, 4);

	Layout();
	SetBestFittingSize();
}
コード例 #4
0
ファイル: progbar.cpp プロジェクト: sirjuddington/SLumpEd
ProgressBar::ProgressBar()
:	wxFrame(NULL, -1, _T(""), wxDefaultPosition, wxSize(590, -1), wxRAISED_BORDER)//wxCAPTION)
{
	wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
	SetSizer(vbox);

	//logo = new ImageBox(this, get_image_from_pk3(_T("res/edit_tex/logo.png"), wxBITMAP_TYPE_PNG));
	//vbox->Add(logo, 0, wxEXPAND);

	message = new wxStaticText(this, -1, _T("Hello"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
	vbox->Add(message, 0, wxEXPAND);

	progress = new wxGauge(this, -1, 100);
	vbox->Add(progress, 0, wxEXPAND);

	Layout();
	Show(true);
	SetBestFittingSize();
	Center();
}
コード例 #5
0
TrigonometricasClass::TrigonometricasClass(wxWindow* parent)
    : TrigonometricasBaseClass(parent)
{
	SetBestFittingSize();
}
コード例 #6
0
LogaritmicasClass::LogaritmicasClass(wxWindow* parent)
    : LogaritmicasBaseClass(parent)
{
	SetBestFittingSize();
}
コード例 #7
0
ファイル: misc_dialog.cpp プロジェクト: sirjuddington/SLumpEd
GfxConvertDialog::GfxConvertDialog(wxWindow *parent, int type, Image &img)
:	wxDialog(parent, -1, _T(""), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
{
	wxBoxSizer *m_vbox = new wxBoxSizer(wxVERTICAL);
	SetSizer(m_vbox);

	// Transparency frame
	wxStaticBox *frame = new wxStaticBox(this, -1, _T("Transparency"));
	wxStaticBoxSizer *box = new wxStaticBoxSizer(frame, wxVERTICAL);
	m_vbox->Add(box, 0, wxEXPAND|wxALL, 4);

	cbox_trans = new wxCheckBox(this, GCD_CBOX_TRANS, _T("Enable"));
	box->Add(cbox_trans, 0, wxEXPAND|wxALL, 4);

	opt_trans_existing = new wxRadioButton(this, -1, _T("Use Existing"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
	box->Add(opt_trans_existing, 0, wxEXPAND|wxALL, 4);

	wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL);
	box->Add(hbox, 0, wxEXPAND|wxALL, 4);

	opt_trans_col = new wxRadioButton(this, -1, _T("Single Colour: "));
	hbox->Add(opt_trans_col, 0, wxEXPAND|wxRIGHT, 4);

	entry_trans_col = new wxTextCtrl(this, -1, _T("247"));
	hbox->Add(entry_trans_col, 0, wxEXPAND);


	// Colours frame
	frame = new wxStaticBox(this, -1, _T("Colour Depth"));
	box = new wxStaticBoxSizer(frame, wxVERTICAL);
	m_vbox->Add(box, 0, wxEXPAND|wxALL, 4);

	cbox_colours = new wxCheckBox(this, GCD_CBOX_COLOURS, _T("Don't change"));
	box->Add(cbox_colours, 0, wxEXPAND|wxALL, 4);

	opt_32bpp = new wxRadioButton(this, -1, _T("32BPP (RGBA)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
	box->Add(opt_32bpp, 0, wxEXPAND|wxALL, 4);

	opt_256col = new wxRadioButton(this, -1, _T("8BPP (256 Colours)"));
	box->Add(opt_256col, 0, wxEXPAND|wxALL, 4);

	opt_pal_current = new wxRadioButton(this, -1, _T("Current Palette"));
	box->Add(opt_pal_current, 0, wxEXPAND|wxALL, 4);


	// Buttons
	m_vbox->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxEXPAND|wxALL, 4);


	cbox_trans->SetValue(false);
	opt_trans_existing->Enable(false);
	opt_trans_col->Enable(false);
	entry_trans_col->Enable(false);

	cbox_colours->SetValue(true);
	opt_32bpp->Enable(false);
	opt_256col->Enable(false);
	opt_pal_current->Enable(false);

	if (type == 0)
	{
		cbox_colours->SetValue(false);
		cbox_colours->Enable(false);
		opt_pal_current->Enable(true);
		opt_pal_current->SetValue(true);
	}

	Layout();
	SetBestFittingSize();
}