X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/60a2264d5dff7d61adc10ea2eded11d563cfe12d..89efaf2b6595e59af618556d7e79492cab50c73c:/utils/screenshotgen/src/screenshot_main.cpp?ds=sidebyside diff --git a/utils/screenshotgen/src/screenshot_main.cpp b/utils/screenshotgen/src/screenshot_main.cpp index 00f95ac13a..46e28632fb 100644 --- a/utils/screenshotgen/src/screenshot_main.cpp +++ b/utils/screenshotgen/src/screenshot_main.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: screenshot_main.cpp -// Purpose: Implement the Application Frame +// Purpose: Implements the window containing all controls. // Author: Utensil Candel (UtensilCandel@@gmail.com) // RCS-ID: $Id$ // Licence: wxWindows license @@ -10,30 +10,25 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop +#pragma hdrstop #endif -// for all others, include the necessary headers +// for all others, include the necessary headers wxWidgets headers) #ifndef WX_PRECOMP - #include - #include - #include - #include - #include - #include +#include "wx/wx.h" #endif -#include -#include -#include -#include -#include -#include +#include "wx/aboutdlg.h" +#include "wx/dir.h" +#include "wx/filesys.h" #include "screenshot_main.h" #include "ctrlmaskout.h" #include "autocapture.h" +#include "bitmaps/play.xpm" +#include "bitmaps/stop.xpm" + // ---------------------------------------------------------------------------- // ScreenshotFrame @@ -71,15 +66,16 @@ ScreenshotFrame::~ScreenshotFrame() } /* - Do some further customization on some controls generated by wxFormBuilder. - - wxFormBuilder does not allow customizations on some controls; - e.g. you cannot load a richtext file in a wxRichtextCtrl during initialization. + Do some further customization on some controls. - Those customizations will be done here. + NB: under wxGTK for the radio button "unchecked" to be unchecked, it's + important to put the wxRB_GROUP style on the first wxRadioButton + (the one "checked") and no flags on the second one. */ void ScreenshotFrame::InitFBControls() { + m_scrollBar1->SetScrollbar(50, 1, 100, 1); + // Do the default selection for wxComboBox m_comboBox1->Select(0); @@ -96,8 +92,24 @@ void ScreenshotFrame::InitFBControls() m_treeCtrl1->ExpandAll(); // Add items into wxListCtrl - for(long index = 0; index < 5; index++) - m_listCtrl1->InsertItem( index, wxString::Format(_("Item\n(0,%d)"),index)); + m_listCtrl1->InsertColumn(0, "Names"); + m_listCtrl1->InsertColumn(1, "Values"); + for(long index = 0; index < 5; index++) { + m_listCtrl1->InsertItem( index, wxString::Format(_("Item%d"),index)); + m_listCtrl1->SetItem(index, 1, wxString::Format("%d", index)); + } + + // Init file and dir pickers + wxString file, dir; +#if defined(__WXMSW__) + file = "C:\\Windows\\explorer.exe"; + dir = "C:\\Windows"; +#else + file = "/bin/bash"; + dir = "/home"; +#endif + m_filePicker1->SetPath(file); + m_dirPicker1->SetPath(dir); // Check the first item in wxCheckListBox m_checkList1->Check(0); @@ -111,6 +123,10 @@ void ScreenshotFrame::InitFBControls() // set minimum size hints GetSizer()->SetSizeHints(this); + + // add bitmaps to the menus + m_menuCapRect->SetBitmap( wxIcon(play_xpm) ); + m_menuEndCapRect->SetBitmap( wxIcon(stop_xpm) ); } @@ -146,7 +162,7 @@ void ScreenshotFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) wxAboutDialogInfo info; info.SetName(_("Automatic Screenshot Generator")); info.SetVersion(_("1.0")); - info.SetDescription(_("This utility automatically creates screenshots of wxWidgets controls for ues in wxWidgets documentation.")); + info.SetDescription(_("This utility automatically creates screenshots of wxWidgets controls for use in wxWidgets documentation.")); info.SetCopyright(_T("(C) 2008 Utensil Candel")); wxAboutBox(info); @@ -250,7 +266,7 @@ void ScreenshotFrame::OnCaptureAllControls(wxCommandEvent& WXUNUSED(event)) // check if there are other screenshots taken before if (wxFileName::DirExists(dir)) { - int choice = wxMessageBox(_("It seems that you have already generated some screenshots.\nClick YES to delete them all (recommended) or NO to preserve them.\nClick CANCEL to cancel this auto-capture operation."), + int choice = wxMessageBox(_("It seems that you have already generated some screenshots.\n\nClick YES to delete them all (recommended) or NO to preserve them.\nClick CANCEL to cancel this auto-capture operation."), _("Delete existing screenshots?"), wxYES_NO|wxCANCEL|wxICON_QUESTION, this); switch(choice) @@ -290,7 +306,7 @@ void ScreenshotFrame::OnCaptureAllControls(wxCommandEvent& WXUNUSED(event)) auto_cap.RegisterControl(m_slider1); auto_cap.RegisterControl(m_toggleBtn1, AJ_Union); auto_cap.RegisterControl(m_toggleBtn2, AJ_UnionEnd); - auto_cap.RegisterControl(m_hyperlink1); + auto_cap.RegisterControl(m_hyperlink1, wxT("wxHyperlinkCtrl")); auto_cap.RegisterControl(m_spinCtrl1, AJ_RegionAdjust); auto_cap.RegisterControl(m_spinBtn1); auto_cap.RegisterControl(m_scrollBar1);