Example #1
0
void
SelectDrawWidget::SetChanged(DrawsController *draws_controller)
{
	m_dc = draws_controller;
	DrawSet *selected_set = m_dc->GetSet();

	wxSizer *sizer = GetSizer();

	size_t new_draws_count = selected_set->GetDraws()->size();
	size_t new_cb_size = std::max(new_draws_count, MIN_DRAWS_COUNT);
	for (size_t i = new_cb_size; i < m_cb_l.size(); i++) {
		sizer->Detach(m_cb_l[i]);
		m_cb_l[i]->Destroy();
	}

	if (new_cb_size < m_cb_l.size())
		m_cb_l.resize(new_cb_size);

	for (size_t i = new_draws_count; i < MIN_DRAWS_COUNT; i++) {
		m_cb_l[i]->SetLabel(wxString::Format(_T("%d."), i + 1));
		m_cb_l[i]->Enable(FALSE);
		m_cb_l[i]->SetValue(FALSE);
		m_cb_l[i]->SetToolTip(_T(" "));
		m_cb_l[i]->SetBackgroundColour(DRAW3_BG_COLOR);
	}

	InsertSomeDraws(0, new_draws_count > MIN_DRAWS_COUNT ? m_cb_l.size() : new_draws_count);

	if (selected_set->GetDraws()->size() > m_cb_l.size() && !m_timer->IsRunning())
		m_timer->Start(250, true);

	FitInside();
}
Example #2
0
hdDrawingView::hdDrawingView(int diagram, wxWindow *ddParent, hdDrawingEditor *editor, wxSize size, hdDrawing *initialDrawing)// gqbController *controller, gqbModel *model)
	: wxScrolledWindow(ddParent, wxID_ANY, wxPoint(0, 0), size,
	                   wxHSCROLL | wxVSCROLL | wxBORDER | wxRETAINED)
{
	diagramIndex = diagram;
	drawing = initialDrawing;
	drawingEditor = editor;
	canvasSize = size;

#if wxCHECK_VERSION(2, 9, 0)
	FitInside();
#else
	SetVirtualSizeHints(canvasSize);
#endif

	// Hack to avoid selection rectangle drawing bug
	drawSelRect = false;
	// Hack to avoid event problem with simpleTextTool wxTextCrtl at EVT_TEXT event
	simpleTextToolEdit = new wxTextCtrl(this, CTL_TEXTTOOLID, wxT(""), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	simpleTextToolEdit->Hide();
	simpleTextFigure = NULL;
	menuFigure = NULL;
	okTxtButton = new wxBitmapButton(this, CTL_OKBUTTONID, *check_png_bmp, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	okTxtButton->Hide();
	cancelTxtButton = new wxBitmapButton(this, 1981, wxBitmap(*ddcancel_png_img), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	cancelTxtButton->Hide();
	canvasMenu = NULL;
	_tool = NULL;
	_tool = new hdSelectionTool(this);
}
Example #3
0
void LAYER_WIDGET::UpdateLayouts()
{
    m_LayersFlexGridSizer->Layout();
    m_RenderFlexGridSizer->Layout();
    m_LayerPanel->Layout();
    m_RenderingPanel->Layout();
    FitInside();
}
void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
    wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function Begin"));

    unsigned int      i;
    ALL_PROJECTS_LIST pl;
    CMainDocument*    pDoc = wxGetApp().GetDocument();

    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pDescriptionStaticCtrl);
    wxASSERT(m_pProjectUrlStaticCtrl);
    wxASSERT(m_pProjectUrlCtrl);


    m_pTitleStaticCtrl->SetLabel(
        _("Choose an account manager")
    );
    m_pDescriptionStaticCtrl->SetLabel(
        _("To choose an account manager, click its name or \ntype its URL below.")
    );
    m_pProjectUrlStaticCtrl->SetLabel(
        _("Account Manager &URL:")
    );

    // Populate the virtual list control with project information
    //
    if (!m_bAccountManagerListPopulated) {
        pDoc->rpc.get_all_projects_list(pl);
        for (i=0; i<pl.account_managers.size(); i++) {
            wxLogTrace(
                wxT("Function Status"),
                wxT("CAccountManagerInfoPage::OnPageChanged - Name: '%s', URL: '%s', Supported: '%d'"),
                wxString(pl.account_managers[i]->name.c_str(), wxConvUTF8).c_str(),
                wxString(pl.account_managers[i]->url.c_str(), wxConvUTF8).c_str(),
                true
            );

            m_pProjectListCtrl->Append(
                wxString(pl.account_managers[i]->url.c_str(), wxConvUTF8),
                wxString(pl.account_managers[i]->name.c_str(), wxConvUTF8),
                wxString(pl.account_managers[i]->image.c_str(), wxConvUTF8),
                wxString(pl.account_managers[i]->description.c_str(), wxConvUTF8),
                false,
                false,
                false,
                true
            );
        }
        m_bAccountManagerListPopulated = true;
    }

    Layout();
    FitInside();
    m_pProjectListCtrl->SetFocus();

    wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function End"));
}
Example #5
0
void MainFrame::OnGridPanelSize(wxSizeEvent &event) {
  auto grid = dynamic_cast<wxGridSizer *>(splitter->GetWindow2()->GetSizer());
  auto size = event.GetSize();
  int col = (size.GetWidth() / 250);
  grid->SetCols(col > 0 ? col : 1);

  grid->FitInside(splitter->GetWindow2());
  splitter->Refresh();
  splitter->Update();
}
Example #6
0
void SelectDrawWidget::OnTimer(wxTimerEvent&) {
	DrawSet *selected_set = m_dc->GetSet();
	if (!selected_set)
		return;

	if (selected_set->GetDraws()->size() <= m_cb_l.size())
		return;

	InsertSomeDraws(m_cb_l.size(), std::min(MIN_DRAWS_COUNT, selected_set->GetDraws()->size() - m_cb_l.size()));

	if (selected_set->GetDraws()->size() > m_cb_l.size())
		m_timer->Start(250, true);		

	FitInside();
}
Example #7
0
void wxFoldPanelBar::Create( wxWindow *parent, wxWindowID id, const wxPoint &position,
                             const wxSize& size, long style, long extraStyle )
{

    m_extraStyle = extraStyle;

    // make sure there is any orientation
    if ( (style & wxFPB_HORIZONTAL) != wxFPB_HORIZONTAL )
        style |= wxFPB_VERTICAL;

    // create the panel (duh!). This causes a size event, which we are going
    // to skip when we are not initialised

    wxPanel::Create(parent, id, position, size, style);

	// Erase the background.
	SetBackgroundStyle(wxBG_STYLE_SYSTEM);

    // the fold panel area
    m_panelSizer = new /*wxBoxSizer*/wxSequentialSizer(wxVERTICAL);

    SetSizer(m_panelSizer);

	FitInside(); // ask the sizer about the needed size
	SetScrollRate(5, 5);

#if 0
    // create the fold icons to be used in the captions
    m_images = new wxImageList(16, 16);

    wxBitmap *bmp = new wxBitmap(icon_expanded);
    m_images->Add(*bmp);
    delete bmp;

    bmp = new wxBitmap(icon_collapsed);
    m_images->Add(*bmp);
    delete bmp;

    m_moreBmp = new wxBitmap(icon_theresmore);
#else
    m_images = NULL;
    m_moreBmp = NULL;
#endif

    // do this as last, to check if create is already called

    m_controlCreated = true;
}
Example #8
0
void VariationControl::OnObjectSettingsChange(const ObjectSettings& settings)
{
	Freeze();

	const std::vector<ObjectSettings::Group>& variation = settings.GetActorVariation();

	// Creating combo boxes seems to be pretty expensive - so we create as
	// few as possible, by never deleting any.

	size_t oldCount = m_ComboBoxes.size();
	size_t newCount = variation.size();

	// If we have too many combo boxes, hide the excess ones
	for (size_t i = newCount; i < oldCount; ++i)
	{
		m_ComboBoxes[i]->Show(false);
	}

	for (size_t i = 0; i < variation.size(); ++i)
	{
		const ObjectSettings::Group& group = variation[i];

		if (i < oldCount)
		{
			// Already got enough boxes available, so use an old one
			wxComboBox* comboBox = m_ComboBoxes[i];
			// Replace the contents of the old combobox with the new data
			comboBox->Freeze();
			comboBox->Clear();
			comboBox->Append(group.variants);
			comboBox->SetValue(group.chosen);
			comboBox->Show(true);
			comboBox->Thaw();
		}
		else
		{
			// Create an initially empty combobox, because we can fill it
			// quicker than the default constructor can
			wxComboBox* combo = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition,
				wxSize(80, wxDefaultCoord), wxArrayString(), wxCB_READONLY);
			// Freeze it before adding all the values
			combo->Freeze();
			combo->Append(group.variants);
			combo->SetValue(group.chosen);
			combo->Thaw();
			// Add the on-select event handler
			combo->Connect(wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED,
				wxCommandEventHandler(VariationControl::OnSelect), NULL, this);
			// Add box to sizer and list
			m_Sizer->Add(combo, wxSizerFlags().Expand());
			m_ComboBoxes.push_back(combo);
		}
	}

	Layout();

	Thaw();

	// Make the scrollbars appear when appropriate
	FitInside();
}
Example #9
0
/*
*  updateModelSize
*     - Update the model size.
*     - Calculate the maximum width and maximum height of the model
*  * When removed a table/view from model, the obj parameter must be null,
*    and update parameter should be true, otherwise update parameter should
*    be false (Dragging event)
*/
void gqbView::updateModelSize(gqbQueryObject *obj, bool updateAnyWay)
{
	static int callCount = 0;
	callCount++;
	if (!obj)
	{
		// Do not update model size, everytime it gets called
		// Update the size once in 10 times
		// Update the size only if update flag is true
		if (callCount < 10 && !updateAnyWay)
			return;
		callCount = 0;
		// Figure out the actual model size.
		// Remove table
		int w = 0, h = 0, maxW = 0, maxH = 0;
		if(!iterator)
			// Get an iterator for the objects (tables/views) in the model.
			iterator = this->model->createQueryIterator();
		else
			iterator->ResetIterator();

		while (iterator->HasNext())
		{
			gqbQueryObject *tmp = (gqbQueryObject *)iterator->Next();;
			w = tmp->position.x + tmp->getWidth();
			h = tmp->position.y + tmp->getHeight();

			if (maxW < w)
				maxW = w;
			if (maxH < h)
				maxH = h;
		}

		// Reset Model size
		modelSize.Set(maxW, maxH);
	}
	else
	{
		int w = 0, h = 0;
		w = obj->position.x + obj->getWidth();
		h = obj->position.y + obj->getHeight();

		if (w > modelSize.GetWidth())
			modelSize.SetWidth(w);
		if (h > modelSize.GetHeight())
			modelSize.SetHeight(h);
	}
	bool updateView = false;
	int viewW, viewH;
	GetSize(&viewW, &viewH);

	if (viewW < GQB_MIN_WIDTH)
		viewW = GQB_MIN_WIDTH;

	if (viewH < GQB_MIN_HEIGHT)
		viewH = GQB_MIN_HEIGHT;

	if ((modelSize.GetWidth() > viewW || canvasSize.GetWidth() > viewW) &&
	        modelSize.GetWidth() != canvasSize.GetWidth())
	{
		canvasSize.SetWidth((modelSize.GetWidth() > viewW ? modelSize.GetWidth() : viewW));
		updateView = true;
	}
	if ((modelSize.GetHeight() > viewH || canvasSize.GetHeight() > viewH ) &&
	        modelSize.GetHeight() != canvasSize.GetHeight())
	{
		canvasSize.SetHeight((modelSize.GetHeight() > viewH ? modelSize.GetHeight() : viewH));
		updateView = true;
	}

	if (canvasSize.GetWidth() < viewW)
	{
		canvasSize.SetWidth(viewW);
		updateView = true;
	}

	if (canvasSize.GetHeight() < viewH)
	{
		canvasSize.SetHeight(viewH);
		updateView = true;
	}

	if (updateView)
	{
		SetVirtualSize(canvasSize);
	}

	FitInside();
	Refresh();
}
Example #10
0
void wxFoldPanelBar::OnSizePanel(wxSizeEvent &event)
{
	FitInside();
}
void CProjectInfoPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
    wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanged - Function Begin"));

    unsigned int                i, j, k;
    bool                        bSupportedPlatformFound = false;
    bool                        bProjectSupportsNvidiaGPU = false;
    bool                        bProjectSupportsATIGPU = false;
    bool                        bProjectSupportsMulticore = false;
    ALL_PROJECTS_LIST           pl;
    CMainDocument*              pDoc = wxGetApp().GetDocument();

    wxASSERT(pDoc);
    wxASSERT(wxDynamicCast(pDoc, CMainDocument));
    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pDescriptionStaticCtrl);
    wxASSERT(m_pProjectListCtrl);
    wxASSERT(m_pProjectUrlStaticCtrl);
    wxASSERT(m_pProjectUrlCtrl);

    m_pTitleStaticCtrl->SetLabel(
        _("Choose a project")
    );
    m_pDescriptionStaticCtrl->SetLabel(
        _("To choose a project, click its name or type its URL below.")
    );
    m_pProjectUrlStaticCtrl->SetLabel(
        _("Project &URL:")
    );


    // Populate the virtual list control with project information
    //
    if (!m_bProjectListPopulated) {
        std::vector<std::string> &client_platforms = pDoc->state.platforms;
        pDoc->rpc.get_all_projects_list(pl);

        for (i=0; i<pl.projects.size(); i++) {
            bSupportedPlatformFound = false;
            bProjectSupportsNvidiaGPU = false;
            bProjectSupportsATIGPU = false;
            bProjectSupportsMulticore = false;

            wxLogTrace(
                wxT("Function Status"),
                wxT("CProjectInfoPage::OnPageChanged - Name: '%s', URL: '%s'"),
                wxString(pl.projects[i]->name.c_str(), wxConvUTF8).c_str(),
                wxString(pl.projects[i]->url.c_str(), wxConvUTF8).c_str()
            );

            std::vector<std::string> &project_platforms = pl.projects[i]->platforms;

            // Can the core client support a platform that this project
            //   supports?
            for (j = 0; j < client_platforms.size(); j++) {
                for (k = 0; k < project_platforms.size(); k++) {
                    wxString strClientPlatform = wxString(client_platforms[j].c_str(), wxConvUTF8);
                    wxString strProjectPlatform = wxString(project_platforms[k].c_str(), wxConvUTF8);
                    wxString strRootProjectPlatform = strProjectPlatform.SubString(0, strProjectPlatform.Find(_T("[")) - 1);

                    if (strProjectPlatform.Find(_T("[cuda")) != wxNOT_FOUND) {
                        if ((pDoc->state.have_cuda) && (strClientPlatform == strRootProjectPlatform)) {
                            bProjectSupportsNvidiaGPU = true;
                            bSupportedPlatformFound = true;
                        }
                    }

                    if (strProjectPlatform.Find(_T("[ati")) != wxNOT_FOUND) {
                        if ((pDoc->state.have_ati) && (strClientPlatform == strRootProjectPlatform)) {
                            bProjectSupportsATIGPU = true;
                            bSupportedPlatformFound = true;
                        }
                    }

                    if (strProjectPlatform.Find(_T("[mt")) != wxNOT_FOUND) {
                        if ((pDoc->host.p_ncpus >= 4) && (strClientPlatform == strRootProjectPlatform)) {
                            bProjectSupportsMulticore = true;
                            bSupportedPlatformFound = true;
                        }
                    }

                    if (strClientPlatform == strRootProjectPlatform) {
                        bSupportedPlatformFound = true;
                    }
                }
            }

            wxLogTrace(
                wxT("Function Status"),
                wxT("CProjectInfoPage::OnPageChanged - Nvidia: '%d', ATI: '%d', Multicore: '%d', Platform: '%d'"),
                bProjectSupportsNvidiaGPU,
                bProjectSupportsATIGPU,
                bProjectSupportsMulticore,
                bSupportedPlatformFound
            );

            m_pProjectListCtrl->Append(
                wxString(pl.projects[i]->url.c_str(), wxConvUTF8),
                wxString(pl.projects[i]->name.c_str(), wxConvUTF8),
                wxString(pl.projects[i]->image.c_str(), wxConvUTF8),
                wxString(pl.projects[i]->description.c_str(), wxConvUTF8),
                bProjectSupportsNvidiaGPU,
                bProjectSupportsATIGPU,
                bProjectSupportsMulticore,
                bSupportedPlatformFound
            );
        }

        // Pre select the first element
        if (m_pProjectListCtrl->GetItemCount()) {
            m_pProjectListCtrl->SetSelection(0);
            m_strProjectURL = m_pProjectListCtrl->GetItem(0)->GetURL();
            m_bProjectSupported = m_pProjectListCtrl->GetItem(0)->IsPlatformSupported();
        }

        TransferDataToWindow();

        m_bProjectListPopulated = true;
    }

    Layout();
    FitInside();
    m_pProjectListCtrl->SetFocus();

    wxLogTrace(wxT("Function Start/End"), wxT("CProjectInfoPage::OnPageChanged - Function End"));
}
Example #12
0
void CAccountManagerInfoPage::OnPageChanged( wxWizardExEvent& event ) {
    if (event.GetDirection() == false) return;
    wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function Begin"));

    unsigned int      i;
    ALL_PROJECTS_LIST pl;
    CMainDocument*    pDoc = wxGetApp().GetDocument();

    wxASSERT(m_pTitleStaticCtrl);
    wxASSERT(m_pDescriptionStaticCtrl);
    wxASSERT(m_pProjectDetailsStaticCtrl);
    wxASSERT(m_pProjectDetailsDescriptionCtrl);
    wxASSERT(m_pOpenWebSiteButton);
    wxASSERT(m_pProjectUrlStaticCtrl);
    wxASSERT(m_pProjectUrlCtrl);


    m_pTitleStaticCtrl->SetLabel(
        _("Choose an account manager")
    );
    m_pDescriptionStaticCtrl->SetLabel(
        _("To choose an account manager, click its name or \ntype its URL below.")
    );

    m_pProjectDetailsStaticCtrl->SetLabel(
        _("Account manager details:")
    );

    m_pProjectUrlStaticCtrl->SetLabel(
        _("Account manager &URL:")
    );

    m_pOpenWebSiteButton->SetLabel(
        _("Open web page")
    );

    m_pOpenWebSiteButton->SetToolTip( _("Visit this account manager's web site"));

    // Populate the list box with project information
    //
    if (!m_bAccountManagerListPopulated) {
        pDoc->rpc.get_all_projects_list(pl);
        for (i=0; i<pl.account_managers.size(); i++) {
            wxLogTrace(
                wxT("Function Status"),
                wxT("CAccountManagerInfoPage::OnPageChanged - Name: '%s', URL: '%s', Supported: '%d'"),
                wxString(pl.account_managers[i]->name.c_str(), wxConvUTF8).c_str(),
                wxString(pl.account_managers[i]->url.c_str(), wxConvUTF8).c_str(),
                true
            );

            CAcctMgrListItem* pItem = new CAcctMgrListItem();

            pItem->SetURL( pl.account_managers[i]->url.c_str() );
            pItem->SetName( pl.account_managers[i]->name.c_str() );
            pItem->SetImage( pl.account_managers[i]->image.c_str() );
            pItem->SetDescription( pl.account_managers[i]->description.c_str() );

            
            m_pProjectListCtrl->Append(
                wxString(pl.account_managers[i]->name.c_str(), wxConvUTF8),
                pItem
            );
        }

        // Pre select the first element
        if (m_pProjectListCtrl->GetCount()) {
            m_pProjectListCtrl->SetSelection(0);
            CAcctMgrListItem* pItem = (CAcctMgrListItem*)(m_pProjectListCtrl->GetClientData(0));
            SetProjectURL(pItem->GetURL());
            m_pProjectDetailsDescriptionCtrl->SetValue(pItem->GetDescription());
        }

        TransferDataToWindow();

        m_bAccountManagerListPopulated = true;
    }

    Layout();
    FitInside();
    m_pProjectListCtrl->SetFocus();

    wxLogTrace(wxT("Function Start/End"), wxT("CAccountManagerInfoPage::OnPageChanged - Function End"));
}
Example #13
0
/* ArgsPanel::setup
 * Sets up the arg names and descriptions from specification in [args]
 *******************************************************************/
void ArgsPanel::setup(argspec_t* args)
{
	// Reset stuff
	fg_sizer->Clear();
	for (unsigned a = 0; a < 5; a++)
	{
		if (control_args[a])
			control_args[a]->Destroy();
		control_args[a] = NULL;
		label_args[a]->SetLabelText(S_FMT("Arg %d:", a + 1));
		label_args_desc[a]->Show(false);
	}

	// Setup layout
	int row = 0;
	for (unsigned a = 0; a < 5; a++)
	{
		arg_t& arg = args->getArg(a);
		bool has_desc = false;
		
		if ((int)a < args->count) {
			has_desc = !arg.desc.IsEmpty();

			if (arg.type == ARGT_CHOICE)
				control_args[a] = new ArgsChoiceControl(this, arg.custom_values);
			else if (arg.type == ARGT_FLAGS)
				control_args[a] = new ArgsFlagsControl(this, arg.custom_flags);
			else if (arg.type == ARGT_SPEED)
				control_args[a] = new ArgsSpeedControl(this);
			else
				control_args[a] = new ArgsTextControl(this);
		}
		else {
			control_args[a] = new ArgsTextControl(this);
		}

		// Arg name
		label_args[a]->SetLabelText(S_FMT("%s:", arg.name));
		fg_sizer->Add(label_args[a], wxSizerFlags().Align(wxALIGN_TOP|wxALIGN_RIGHT).Border(wxALL, 4));

		// Arg value
		fg_sizer->Add(control_args[a], wxSizerFlags().Expand());
		
		// Arg description
		if (has_desc)
		{
			// Add an empty spacer to the first column
			fg_sizer->Add(0, 0);
			fg_sizer->Add(label_args_desc[a], wxSizerFlags().Expand());
		}
	}

	Layout();

	// Setup controls
	int available_width = fg_sizer->GetColWidths()[1];
	for (int a = 0; a < args->count; a++)
	{
		arg_t& arg = args->getArg(a);

		if (!arg.desc.IsEmpty())
		{
			label_args_desc[a]->Show(true);
			label_args_desc[a]->SetLabelText(arg.desc);
			label_args_desc[a]->Wrap(available_width);
		}
	}

	FitInside();  // for wxScrolled's benefit
}
Example #14
0
void MainFrame::OnTreeSelectionChanged(wxTreeEvent &event) {
  auto treeItemId = event.GetItem();
  auto rootId = dirTree->GetRootItem();
  auto currentFileEntry =
      dynamic_cast<EntryItemData *>(dirTree->GetItemData(treeItemId))->Get();

  auto gridPanel = dynamic_cast<wxScrolledWindow *>(splitter->GetWindow2());

  if (loadThread) {
    loadThread->Delete(nullptr, wxTHREAD_WAIT_BLOCK);
    loadThread = nullptr;
  }

  gridPanel->Show(false);
  auto grid = gridPanel->GetSizer();
  grid->Clear(true);

  std::vector<Entry *> loadEntries;
  imgButtons.clear();
  for (int i = 0; i < currentFileEntry->Count(); ++i) {
    Entry *childEntry = (*currentFileEntry)[i];

    if (childEntry->IsDirectory())
      continue;
    auto ext = childEntry->Name().AfterLast('.').Lower();

    if (ext != "jpg" && ext != "jpeg" && ext != "png" && ext != "gif")
      continue;

    loadEntries.push_back(childEntry);
  }

  for (auto entry : loadEntries) {
    auto button = new wxButton(gridPanel, wxID_ANY, "", wxDefaultPosition,
                               wxDefaultSize, wxBU_EXACTFIT);
    imgButtons.push_back(button);
    button->Bind(wxEVT_BUTTON, &MainFrame::OnImageButtonClick, this);

    button->SetClientObject(new EntryItemData(entry));
    button->SetMinSize({250, 250});

    auto staticText = new wxStaticText(gridPanel, wxID_ANY, entry->Name());
    staticText->SetMaxSize({250, 50});

    auto btnSizer = new wxBoxSizer(wxVERTICAL);
    btnSizer->Add(button, 0, wxEXPAND);
    btnSizer->Add(staticText);

    grid->Add(btnSizer, 0, wxALL | wxEXPAND, 5);
  }

  GetStatusBar()->SetStatusText(wxString::Format("Loading Thumbnail %i of %i",
                                                 1, (int)loadEntries.size()));

  grid->FitInside(gridPanel);
  gridPanel->Show(true);
  gridPanel->Scroll(0, 0);

  gridPanel->Refresh();
  gridPanel->Update();

  loadThread = new ThumbnailLoadThread(this, loadEntries, currentEntry);
  loadThread->Run();
  threadId = loadThread->GetId();
}