/*! \brief Set the image list.
 *
 * \param inImageList wxImageList&
 * \return void
 *
 */
void    wxsImageTreeEditorDlg::SetImageList(wxImageList &inImageList)
{
    int         i, n;
    wxString    ss, tt;
    wxBitmap    bmp;

    // save the image list in the tree control
    Tree1->SetImageList(&inImageList);

    // valid list given?
    n = inImageList.GetImageCount();
    if(n <= 0){
        cbNormal->Enable(false);
        cbSelected->Enable(false);
        cbExpanded->Enable(false);
        cbSelExpanded->Enable(false);
    }
    else {
        cbNormal->Enable(true);
        cbSelected->Enable(true);
        cbExpanded->Enable(true);
        cbSelExpanded->Enable(true);
    }

    // set images in the drop-down lists
    cbNormal->Clear();
    cbSelected->Clear();
    cbExpanded->Clear();
    cbSelExpanded->Clear();

    ss = _("<none>");
    cbNormal->Append(ss);
    cbSelected->Append(ss);
    cbExpanded->Append(ss);
    cbSelExpanded->Append(ss);

    for(i = 0; i < n; i++){
        ss.Printf(wxT("%d"), i);
        bmp = inImageList.GetBitmap(i);

        cbNormal->Append(ss, bmp);
        cbSelected->Append(ss, bmp);
        cbExpanded->Append(ss, bmp);
        cbSelExpanded->Append(ss, bmp);
    }

    // default selections
    cbNormal->SetSelection(0);
    cbSelected->SetSelection(0);
    cbExpanded->SetSelection(0);
    cbSelExpanded->SetSelection(0);
}
Пример #2
0
   MonkeyTable (wxWindow *parent, const wxString &title, MonkeyPrefs &pref, wxImageList &imgs, const wxSize& size = wxDefaultSize) :
   wxDialog(parent, wxID_ANY, title, wxDefaultPosition, size), prefs(pref)
   {
      filters.push_back(_("Thingy table file (*.tbl)|*.tbl"));

      wxBoxSizer *global_sz = new wxBoxSizer(wxVERTICAL);

      wxStaticText *header = new wxStaticText(this, wxID_ANY, _("You can edit the table values below before saving:"));
      wxDataViewListCtrl *datavw = new wxDataViewListCtrl(this, MonkeyTable_DataTable);

      datavw->AppendTextColumn(_("Byte"), wxDATAVIEW_CELL_EDITABLE);
      datavw->AppendTextColumn(_("Value"), wxDATAVIEW_CELL_EDITABLE);

      wxBoxSizer *tblnm_sz = new wxBoxSizer(wxHORIZONTAL);
      wxStaticText *flnmhd = new wxStaticText(this, wxID_ANY, _("Name "));
      wxTextCtrl *flnm = new wxTextCtrl(this, MonkeyTable_FileName);
      wxBitmapButton *browse = new wxBitmapButton(this, MonkeyTable_SaveTable, imgs.GetBitmap(MonkeyBmp_SaveFile));

      browse->SetDefault();

      tblnm_sz->Add(flnmhd, wxSizerFlags().Border(wxRIGHT, 5).Border(wxTOP, 4));
      tblnm_sz->Add(flnm, wxSizerFlags(1).Expand().Border(wxRIGHT, 5));
      tblnm_sz->Add(browse);

      wxBoxSizer *tblopt_sz = new wxBoxSizer(wxHORIZONTAL);
      wxStaticText *flfmthd = new wxStaticText(this, wxID_ANY, _("Format "));
      wxChoice *flfmt = new wxChoice(this, MonkeyTable_FileFmt);
      wxStaticText *flenchd = new wxStaticText(this, wxID_ANY, _("Encoding "));
      wxChoice *flenc = new wxChoice(this, MonkeyTable_FileEnc);

      flfmt->AppendString(_("Thingy table file (*.tbl)"));
      flfmt->SetSelection(0);

      flenc->AppendString(_("ANSI (ISO-8859-1)"));
      flenc->AppendString(_("Unicode (UTF-8)"));
      flenc->AppendString(_("Unicode (UTF-16)"));
      //flenc->AppendString(_("Shift-JIS (SJIS)"));
      flenc->SetSelection(1);

      tblopt_sz->Add(flfmthd, wxSizerFlags().Border(wxRIGHT, 5).Border(wxTOP, 4));
      tblopt_sz->Add(flfmt, wxSizerFlags().Border(wxRIGHT, 5));
      tblopt_sz->AddStretchSpacer(1);
      tblopt_sz->Add(flenchd, wxSizerFlags().Border(wxRIGHT, 5).Border(wxTOP, 4).Right());
      tblopt_sz->Add(flenc, wxSizerFlags().Right());

      global_sz->Add(header, wxSizerFlags().Border(wxTOP | wxLEFT | wxRIGHT, 10));
      global_sz->Add(datavw, wxSizerFlags(1).Expand().Border(wxALL, 10));
      global_sz->Add(tblnm_sz, wxSizerFlags().Expand().Border(wxRIGHT | wxLEFT, 10));
      global_sz->Add(tblopt_sz, wxSizerFlags().Expand().Border(wxALL, 10));
      SetSizer(global_sz);
   }