35 DIALOG_SHIM( aParent, wxID_ANY,
_(
"Git Branch Switch" ), wxDefaultPosition, wxDefaultSize,
36 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
43 m_branches( std::move( aBranches ) )
46 std::erase_if( m_branches,
51 std::sort( m_branches.begin(), m_branches.end(),
54 return aFirst.name < aSecond.name;
57 wxBoxSizer* sizer =
new wxBoxSizer( wxVERTICAL );
60 wxStaticText* explanationText =
61 new wxStaticText(
this, wxID_ANY,
_(
"Select or enter a branch name:" ) );
62 sizer->Add( explanationText, 0, wxALL, 10 );
65 m_branchList =
new wxListView(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
66 wxLC_REPORT | wxLC_SINGLE_SEL );
67 m_branchList->InsertColumn( 0,
_(
"Branch" ) );
68 m_branchList->InsertColumn( 1,
_(
"Last Commit" ) );
69 m_branchList->InsertColumn( 2,
_(
"Last Updated" ) );
70 sizer->Add( m_branchList, 1, wxALL | wxEXPAND, 10 );
73 m_branchNameText =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition,
74 wxDefaultSize, wxTE_PROCESS_ENTER );
75 sizer->Add( m_branchNameText, 0, wxALL | wxEXPAND, 10 );
78 wxStdDialogButtonSizer* buttonSizer =
new wxStdDialogButtonSizer();
79 m_switchButton =
new wxButton(
this, wxID_OK,
_(
"Switch" ) );
80 buttonSizer->AddButton( m_switchButton );
81 m_switchButton->Disable();
82 wxButton* cancelButton =
new wxButton(
this, wxID_CANCEL,
_(
"Cancel" ) );
83 buttonSizer->AddButton( cancelButton );
84 buttonSizer->Realize();
85 sizer->Add( buttonSizer, 0, wxALIGN_RIGHT | wxALL, 10 );
98 SetSizerAndFit( sizer );
100 finishDialogSettings();
115 long currentIndex = -1;
120 wxString
displayName = ( branch.isCurrent ? wxS(
"* " ) : wxS(
" " ) ) + branch.name;
124 m_branchList->SetItem( itemIndex, 2, branch.when.Format() );
126 if( branch.isCurrent )
129 currentIndex = itemIndex;
137 if( currentIndex >= 0 )
DIALOG_SHIM(wxWindow *aParent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER, const wxString &name=wxDialogNameStr)