示例#1
0
// Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title)
       : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300))
{
#if wxUSE_STATUSBAR
    CreateStatusBar();
#endif // wxUSE_STATUSBAR

    SetIcon(wxICON(sample));

    m_server = NULL;

    wxPanel * const panel = new wxPanel(this);

    wxBoxSizer * const sizerMain = new wxBoxSizer( wxVERTICAL );

    wxFlexGridSizer * const sizerCmds = new wxFlexGridSizer( 2, 0, 0 );
    sizerCmds->AddGrowableCol( 1 );

    wxButton *btn;

    btn = new wxButton(panel, ID_START, "&Start Server");
    sizerCmds->Add(btn, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    const wxString choices[] = { IPC_SERVICE, "..." };
    wxChoice * const choice = new wxChoice
                                  (
                                    panel,
                                    ID_SERVERNAME,
                                    wxDefaultPosition, wxSize(100, -1),
                                    WXSIZEOF(choices), choices
                                  );
    sizerCmds->Add(choice, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    btn = new wxButton(panel, ID_DISCONNECT, "&Disconnect Client");
    sizerCmds->Add(btn, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
    sizerCmds->AddSpacer(20);

    btn = new wxButton( panel, ID_ADVISE, "&Advise");
    sizerCmds->Add(btn, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
    sizerCmds->AddSpacer(20);

    sizerMain->Add(sizerCmds, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxStaticBoxSizer * const
        sizerLog = new wxStaticBoxSizer(wxVERTICAL, panel, "Server &log");

    wxTextCtrl * const textLog = new wxTextCtrl
                                 (
                                    panel,
                                    wxID_ANY,
                                    "",
                                    wxDefaultPosition, wxSize(500, 140),
                                    wxTE_MULTILINE
                                 );
    sizerLog->Add(textLog, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    sizerMain->Add(sizerLog, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);

    panel->SetSizer(sizerMain);
    sizerMain->SetSizeHints(panel);
    SetClientSize(panel->GetSize());

    GetServername()->SetSelection(0);
    wxLogTextCtrl *logWindow = new wxLogTextCtrl(textLog);
    delete wxLog::SetActiveTarget(logWindow);
    wxLogMessage("Click on Start to start the server");
    UpdateUI();
}
示例#2
0
ProcessesDialog::ProcessesDialog( wxWindow* parent )
    : wxDialog( parent, wxID_ANY, _("Processes"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER )
{
	
	wxFlexGridSizer* fgSizer2;
	fgSizer2 = new wxFlexGridSizer( 1, 1, 0, 0 );
	fgSizer2->AddGrowableCol( 0 );
	fgSizer2->AddGrowableRow( 0 );
	fgSizer2->SetFlexibleDirection( wxBOTH );
	
	wxStaticBoxSizer* sbSizer1;
	sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, -1, wxT("Available Processes") ), wxHORIZONTAL );
	
	wxFlexGridSizer* fgSizer1;
	fgSizer1 = new wxFlexGridSizer( 2, 1, 0, 0 );
	fgSizer1->AddGrowableCol( 0 );
	fgSizer1->AddGrowableRow( 0 );
	fgSizer1->SetFlexibleDirection( wxBOTH );
	
	m_processList = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxSize(400, 300), wxLC_REPORT | wxLC_SINGLE_SEL);
    m_processList->InsertColumn(0, "Process");
    m_processList->InsertColumn(1, "ID");
    m_processList->InsertColumn(2, "Title");	

    m_processList->SetColumnWidth(0, 100);
    m_processList->SetColumnWidth(1, 50);
    m_processList->SetColumnWidth(2, 350);

    fgSizer1->Add( m_processList, 0, wxALL|wxEXPAND, 5 );
	
	sbSizer1->Add( fgSizer1, 1, wxEXPAND, 5 );
	
	fgSizer2->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 );
	
	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxHORIZONTAL );
	
	m_refresh = new wxButton( this, ID_Refresh, wxT("&Refresh"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer1->Add( m_refresh, 0, wxALL, 5 );
	
	m_attach = new wxButton( this, wxID_OK, wxT("&Attach"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer1->Add( m_attach, 0, wxALL, 5 );
	
	m_close = new wxButton( this, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer1->Add( m_close, 0, wxALL, 5 );
	
	fgSizer2->Add( bSizer1, 1, wxALL | wxALIGN_RIGHT, 5 );
	
	SetSizer( fgSizer2 );
	
    wxSize minSize = fgSizer2->GetMinSize();
    SetClientSize(minSize);
    SetMinSize(GetSize());
    
    Layout();

    m_sortColumn = 0;
    m_sortForward = true;

    Refresh();

}
示例#3
0
LabelDialog::LabelDialog(wxWindow *parent,
                         DirManager *dirmanager,
                         TrackList *tracks,
                         ViewInfo &viewinfo,
                         double rate,
                         const wxString & format)
: wxDialog(parent,
           wxID_ANY,
           _("Edit Labels"),
           wxDefaultPosition,
           wxSize(800, 600),
           wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
  mDirManager(dirmanager),
  mTracks(tracks),
  mViewInfo(&viewinfo),
  mRate(rate),
  mFormat(format)
{
   SetName(GetTitle());

   // Create the main sizer
   wxBoxSizer *vs = new wxBoxSizer(wxVERTICAL);

   // A little instruction
   wxStaticText *instruct =
      safenew wxStaticText(this,
                       wxID_ANY,
                       _("Press F2 or double click to edit cell contents."));
   instruct->SetName(instruct->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
   vs->Add(instruct,
           0,
           wxALIGN_LEFT | wxALL,
           5);

   // Create the main sizer
   mGrid = new Grid(this, wxID_ANY);
   vs->Add(mGrid, 1, wxEXPAND | wxALL, 5);

   // Create the action buttons
   wxBoxSizer *hs = new wxBoxSizer(wxHORIZONTAL);
   hs->Add(safenew wxButton(this, ID_INSERTA, _("Insert &After")), 1, wxCENTER | wxALL, 5);
   hs->Add(safenew wxButton(this, ID_INSERTB, _("Insert &Before")), 1, wxCENTER | wxALL, 5);
   hs->Add(safenew wxButton(this, ID_REMOVE, _("&Remove")), 1, wxCENTER | wxALL, 5);
   hs->Add(safenew wxButton(this, ID_IMPORT, _("&Import...")), 1, wxCENTER | wxALL, 5);
   hs->Add(safenew wxButton(this, ID_EXPORT, _("&Export...")), 1, wxCENTER | wxALL, 5);
   vs->Add(hs, 0, wxEXPAND | wxCENTER | wxALL, 5);

   // Create the exit buttons
   vs->Add(CreateStdButtonSizer(this, eCancelButton|eOkButton), 0, wxEXPAND);

   // Make it so
   SetSizer(vs);

   // Build the initial (empty) grid
   mGrid->CreateGrid(0, Col_Max);
   mGrid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER);

   /* i18n-hint: (noun).  A track contains waves, audio etc.*/
   mGrid->SetColLabelValue(0,_("Track"));
   /* i18n-hint: (noun)*/
   mGrid->SetColLabelValue(1,_("Label"));
   /* i18n-hint: (noun) of a label*/
   mGrid->SetColLabelValue(2,_("Start Time"));
   /* i18n-hint: (noun) of a label*/
   mGrid->SetColLabelValue(3,_("End Time"));

   // Create and remember editors.  No need to DELETE these as the wxGrid will
   // do it for us.
   mChoiceEditor = (ChoiceEditor *) mGrid->GetDefaultEditorForType(GRID_VALUE_CHOICE);
   mTimeEditor = (TimeEditor *) mGrid->GetDefaultEditorForType(GRID_VALUE_TIME);

   // Initialize and set the track name column attributes
   wxGridCellAttr *attr = new wxGridCellAttr();
   attr->SetEditor(mChoiceEditor);
   mGrid->SetColAttr(Col_Track, attr);
   mTrackNames.Add(_("New..."));

   // Initialize and set the time column attributes
   attr = new wxGridCellAttr();
   attr->SetRenderer(mGrid->GetDefaultRendererForType(GRID_VALUE_TIME));
   attr->SetEditor(mTimeEditor);
   attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
   mGrid->SetColAttr(Col_Stime, attr);
   mGrid->SetColAttr(Col_Etime, attr->Clone());

   // Seems there's a bug in wxGrid.  Adding only 1 row does not
   // allow SetCellSize() to work properly and you will not get
   // the expected 1 row by 4 column cell.
   //
   // So, we set the minimum row height to 0 and basically hide
   // the extra row by setting its height to 0.  And not allowing the
   // rows to be manually resized prevents the user from ever seeing
   // the extra row.
   mGrid->SetRowMinimalAcceptableHeight(0);
   mGrid->EnableDragRowSize(false);

   // Locate all labels in current track list
   FindAllLabels();

   // Populate the grid
   TransferDataToWindow();

   // Resize the label name column and ensure it doesn't go below an
   // arbitrary width.
   //
   // This should not be in TransferDataToWindow() since a user might
   // resize the column and we'd resize it back to the minimum.
   mGrid->AutoSizeColumn(Col_Label, false );
   mGrid->SetColSize(Col_Label, wxMax(150, mGrid->GetColSize(Col_Label)));
   mGrid->SetColMinimalWidth(Col_Label, mGrid->GetColSize(Col_Label));

   // Layout the works
   Layout();

   // Resize width based on width of columns and the vertical scrollbar
   wxRect r = mGrid->GetGridColLabelWindow()->GetRect();
   wxScrollBar sb(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL);
   r.width += sb.GetSize().GetWidth() + 6;
   SetClientSize(r.width, 300);

   // Make sure it doesn't go below this size
   r = GetRect();
   SetSizeHints(r.GetWidth(), r.GetHeight());

   // Center on display
   Center();
}
示例#4
0
ImportWizardDialog::ImportWizardDialog(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
: wxDialog(parent, id, title, pos, size, style) {

  SetTitle(_("Import shortcuts"));

  int border = 12;
  int gap = 8;
  int windowWidth = 320;
  int y = border;
  int x = border;

  wxStaticText* infoLabel = new wxStaticText(this, wxID_ANY, wxString::Format(_("This tool will help you import your shortcuts into %s.\n\nPlease select below where you would like to import your shortcuts from:"), APPLICATION_NAME), wxPoint(x, y));
  infoLabel->Wrap(windowWidth - border * 2);
  wxSize infoSize = infoLabel->GetBestSize();
  infoLabel->SetSize(infoSize);

  y += infoSize.GetHeight() + gap * 2;

  bool hasPortableAppsFolder = wxFileName::DirExists(FolderItem::ResolvePath(wxGetApp().GetUser()->GetSettings()->PortableAppsPath));

  wxArrayString sourceNames;
  wxArrayString sourceLabels;
  sourceNames.Add(_T("portableApps")); sourceLabels.Add(_("PortableApps applications"));
  sourceNames.Add(_T("quickLaunch")); sourceLabels.Add(_("Windows Quick Launch toolbar"));
  sourceNames.Add(_T("startupMenu")); sourceLabels.Add(_("Windows Start Menu programs"));

  for (int i = 0; i < sourceNames.Count(); i++) {
    wxString n = sourceNames[i];
    wxString l = sourceLabels[i];

    wxCheckBox* b = new wxCheckBox(this, wxID_ANY, l);
    b->SetSize(x, y, windowWidth - gap * border, -1);
    b->SetName(n);

    choiceCheckBoxes.push_back(b);
    b->Connect(wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ImportWizardDialog::OnCheckBoxClicked), NULL, this);

    if (n == _T("portableApps")) {
      b->Enable(hasPortableAppsFolder);
      if (hasPortableAppsFolder) b->SetValue(true);
    }

    if (n == _T("quickLaunch")) b->Enable(wxFileName::DirExists(FilePaths::GetQuickLaunchDirectory()));
    
    y += b->GetSize().GetHeight() + gap;
  }

  y += gap;

  statusLabel = new wxStaticText(this, wxID_ANY, _T(" "), wxPoint(border, y), wxSize(windowWidth - gap * 2, -1));
  wxFont font(statusLabel->GetFont());
  font.SetWeight(wxBOLD);
  statusLabel->SetFont(font);
  
  y += statusLabel->GetSize().GetHeight() + gap * 1.5;

  startButton = new wxButton(this, ID_IMPORTWIZDLG_BUTTON_Start, _("Start >>"));
  startButton->SetSize(startButton->GetBestSize());

  cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
  cancelButton->SetSize(cancelButton->GetBestSize());

  startButton->SetPosition(wxPoint(windowWidth - border - startButton->GetSize().GetWidth(), y));
  cancelButton->SetPosition(wxPoint(startButton->GetPosition().x - gap - cancelButton->GetSize().GetWidth(), y));

  y += startButton->GetSize().GetHeight();

  y += border;
  SetClientSize(windowWidth, y);

  OnCheckBoxClicked(wxCommandEvent());
}
示例#5
0
SettingsFrame::SettingsFrame(CreatorFrame* parent, trance_pb::System& system)
: wxFrame{parent,
          wxID_ANY,
          "System settings",
          wxDefaultPosition,
          wxDefaultSize,
          wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN}
, _system{system}
, _parent{parent}
{
  auto panel = new wxPanel{this};
  auto sizer = new wxBoxSizer{wxVERTICAL};
  auto top = new wxBoxSizer{wxHORIZONTAL};
  auto bottom = new wxBoxSizer{wxHORIZONTAL};
  auto left = new wxStaticBoxSizer{wxVERTICAL, panel, "Memory"};
  auto right = new wxStaticBoxSizer{wxVERTICAL, panel, "Rendering"};
  auto right_mode = new wxBoxSizer{wxHORIZONTAL};

  _monitor =
      new wxRadioButton{panel, wxID_ANY, "Monitor", wxDefaultPosition, wxDefaultSize, wxRB_GROUP};
  _oculus = new wxRadioButton{panel, wxID_ANY, "Oculus Rift"};
  _openvr = new wxRadioButton{panel, wxID_ANY, "SteamVR"};

  _enable_vsync = new wxCheckBox{panel, wxID_ANY, "Enable VSync"};
  _image_cache_size = new wxSpinCtrl{panel, wxID_ANY};
  _animation_buffer_size = new wxSpinCtrl{panel, wxID_ANY};
  _font_cache_size = new wxSpinCtrl{panel, wxID_ANY};
  _draw_depth = new wxSlider{panel,
                             wxID_ANY,
                             f2v(_system.draw_depth().draw_depth()),
                             0,
                             8,
                             wxDefaultPosition,
                             wxDefaultSize,
                             wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_VALUE_LABEL};
  _eye_spacing = new wxSpinCtrlDouble{panel, wxID_ANY};
  auto button_ok = new wxButton{panel, wxID_ANY, "OK"};
  auto button_cancel = new wxButton{panel, wxID_ANY, "Cancel"};
  _button_apply = new wxButton{panel, wxID_ANY, "Apply"};

  _monitor->SetToolTip(MONITOR_TOOLTIP);
  _oculus->SetToolTip(OCULUS_TOOLTIP);
  _openvr->SetToolTip(OPENVR_TOOLTIP);
  if (system.renderer() == trance_pb::System::OPENVR) {
    _openvr->SetValue(true);
  } else if (system.renderer() == trance_pb::System::OCULUS) {
    _oculus->SetValue(true);
  } else {
    _monitor->SetValue(true);
    _eye_spacing->Disable();
  }
  _enable_vsync->SetToolTip(VSYNC_TOOLTIP);
  _enable_vsync->SetValue(_system.enable_vsync());
  _image_cache_size->SetToolTip(IMAGE_CACHE_SIZE_TOOLTIP);
  _image_cache_size->SetRange(16, 1024);
  _image_cache_size->SetValue(_system.image_cache_size());
  _animation_buffer_size->SetToolTip(ANIMATION_BUFFER_SIZE_TOOLTIP);
  _animation_buffer_size->SetRange(8, 512);
  _animation_buffer_size->SetValue(_system.animation_buffer_size());
  _font_cache_size->SetToolTip(FONT_CACHE_SIZE_TOOLTIP);
  _font_cache_size->SetRange(2, 256);
  _font_cache_size->SetValue(_system.font_cache_size());
  _draw_depth->SetToolTip(DRAW_DEPTH_TOOLTIP);
  _eye_spacing->SetToolTip(EYE_SPACING_TOOLTIP);
  _eye_spacing->SetRange(-1., 1.);
  _eye_spacing->SetIncrement(1. / 128);
  _eye_spacing->SetValue(_system.eye_spacing().eye_spacing());

  sizer->Add(top, 1, wxEXPAND, 0);
  sizer->Add(bottom, 0, wxEXPAND, 0);
  top->Add(left, 1, wxALL | wxEXPAND, DEFAULT_BORDER);
  top->Add(right, 1, wxALL | wxEXPAND, DEFAULT_BORDER);

  wxStaticText* label = nullptr;
  label = new wxStaticText{panel, wxID_ANY, "Image cache size:"};
  label->SetToolTip(IMAGE_CACHE_SIZE_TOOLTIP);
  left->Add(label, 0, wxALL, DEFAULT_BORDER);
  left->Add(_image_cache_size, 0, wxALL | wxEXPAND, DEFAULT_BORDER);
  label = new wxStaticText{panel, wxID_ANY, "Animation buffer size:"};
  label->SetToolTip(ANIMATION_BUFFER_SIZE_TOOLTIP);
  left->Add(label, 0, wxALL, DEFAULT_BORDER);
  left->Add(_animation_buffer_size, 0, wxALL | wxEXPAND, DEFAULT_BORDER);
  label = new wxStaticText{panel, wxID_ANY, "Font cache size:"};
  label->SetToolTip(IMAGE_CACHE_SIZE_TOOLTIP);
  left->Add(label, 0, wxALL, DEFAULT_BORDER);
  left->Add(_font_cache_size, 0, wxALL | wxEXPAND, DEFAULT_BORDER);
  label = new wxStaticText{panel, wxID_ANY, "Rendering mode:"};
  right->Add(right_mode, 0, wxALL | wxEXPAND, DEFAULT_BORDER);
  right_mode->Add(_monitor, 1, wxALL, DEFAULT_BORDER);
  right_mode->Add(_oculus, 1, wxALL, DEFAULT_BORDER);
  right_mode->Add(_openvr, 1, wxALL, DEFAULT_BORDER);
  right->Add(_enable_vsync, 0, wxALL, DEFAULT_BORDER);
  label = new wxStaticText{panel, wxID_ANY, "Draw depth:"};
  label->SetToolTip(DRAW_DEPTH_TOOLTIP);
  right->Add(label, 0, wxALL, DEFAULT_BORDER);
  right->Add(_draw_depth, 0, wxALL | wxEXPAND, DEFAULT_BORDER);
  _eye_spacing_label = new wxStaticText{panel, wxID_ANY, "Eye spacing (in VR):"};
  _eye_spacing_label->SetToolTip(EYE_SPACING_TOOLTIP);
  right->Add(_eye_spacing_label, 0, wxALL, DEFAULT_BORDER);
  right->Add(_eye_spacing, 0, wxALL | wxEXPAND, DEFAULT_BORDER);

  bottom->Add(button_ok, 1, wxALL, DEFAULT_BORDER);
  bottom->Add(button_cancel, 1, wxALL, DEFAULT_BORDER);
  bottom->Add(_button_apply, 1, wxALL, DEFAULT_BORDER);

  _eye_spacing_label->Enable(!_monitor->GetValue());
  _eye_spacing->Enable(!_monitor->GetValue());
  _button_apply->Enable(false);

  panel->SetSizer(sizer);
  SetClientSize(sizer->GetMinSize());
  CentreOnParent();
  Show(true);

  auto changed = [&](wxCommandEvent&) { Changed(); };
  Bind(wxEVT_RADIOBUTTON, changed);
  Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, changed);
  Bind(wxEVT_SLIDER, changed);
  Bind(wxEVT_SPINCTRL, changed);
  Bind(wxEVT_SPINCTRLDOUBLE, changed);

  button_ok->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) {
    Apply();
    Close();
  });
  button_cancel->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { Close(); });
  _button_apply->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [&](wxCommandEvent&) { Apply(); });

  Bind(wxEVT_CLOSE_WINDOW, [&](wxCloseEvent& event) {
    _parent->SettingsClosed();
    Destroy();
  });
}
示例#6
0
void MyChild::OnChangeSize(wxCommandEvent& WXUNUSED(event))
{
    SetClientSize(100, 100);
}
示例#7
0
void wxBookCtrlBase::SetPageSize(const wxSize& size)
{
    SetClientSize(CalcSizeFromPage(size));
}
示例#8
0
//***************************************************************************************************
//  Input_PTranDialog
//---------------------------------------------------------------
// Input_PTranDialog constructor
//---------------------------------------------------------------
Input_PTranDialog::Input_PTranDialog(wxWindow *parent)
:wxDialog(parent, wxID_ANY, _("Input Periodical transaction"), wxDefaultPosition, wxDefaultSize)
{
#ifdef __WXMSW__
	SetClientSize(wxSize(500,375));
#else
	SetClientSize(wxSize(500,380));
#endif

	ipt_mainPanel = new wxPanel(this,wxID_ANY);

	wxString timing_items[] = {
		_("Indicated ordered day of week"),_("Indicated ordered day of month"),
		_("last day of month")
	};
	wxString holiday_items[] = {
		_("no action"),_("work day of before"),_("work day of after")
	};

	wxStaticBox *sbox = new wxStaticBox(ipt_mainPanel,wxID_ANY,_("Input base transaction"));
	wxStaticBoxSizer *sbsizer = new wxStaticBoxSizer(sbox,wxHORIZONTAL);
	ipt_InputedBaseInfoLabel = new wxStaticText(ipt_mainPanel,wxID_ANY,_T(""),wxDefaultPosition,wxSize(320,100),wxST_NO_AUTORESIZE);
	ipt_InputBaseInfo = new wxButton(ipt_mainPanel, input_ptran_baseinfo, _("Input base"), wxPoint(-1,-1),wxSize(120,-1));
	sbsizer->Add(ipt_InputedBaseInfoLabel,5,wxTOP|wxLEFT);
	sbsizer->Add(ipt_InputBaseInfo,0,wxTOP|wxLEFT);
	ipt_SetAfterInputValue = new wxCheckBox(ipt_mainPanel,wxID_ANY, _("the day will come, open dialog to input value."));
	ipt_SetAfterInputMemo = new wxCheckBox(ipt_mainPanel,wxID_ANY, _("the day will come, open dialog to input memo."));
	ipt_PeriodicalTiming = new wxChoice(ipt_mainPanel,input_ptran_periotiming,wxDefaultPosition,wxSize(100,-1),3,timing_items);
	ipt_PeriodicalTiming->SetSelection(0);
	wxStaticText *label1 = new wxStaticText(ipt_mainPanel,wxID_ANY,_("-th day"));
	ipt_TimingDay = new wxSpinCtrl(ipt_mainPanel, wxID_ANY, _T("1"),wxDefaultPosition,wxSize(65,-1),wxSP_ARROW_KEYS,1,7,1);
	ipt_CaseHolidayTiming = new wxRadioBox(ipt_mainPanel,wxID_ANY,_("Case of holiday"),wxDefaultPosition,wxDefaultSize,3,holiday_items,3,wxRA_SPECIFY_ROWS);

	wxBoxSizer *mbsizer1 = new wxBoxSizer(wxVERTICAL);
	mbsizer1->Add(sbsizer,0,wxTOP|wxLEFT,0);
	mbsizer1->AddSpacer(5);
	mbsizer1->Add(ipt_SetAfterInputValue,0,wxTOP|wxLEFT,0);
	mbsizer1->Add(ipt_SetAfterInputMemo,0,wxTOP,5);
	mbsizer1->AddSpacer(5);
		wxBoxSizer *mbsizer4 = new wxBoxSizer(wxHORIZONTAL);
		mbsizer4->Add(ipt_PeriodicalTiming,0,wxTOP|wxLEFT,0);
		mbsizer4->Add(ipt_TimingDay,0,wxLEFT,5);
		mbsizer4->Add(label1,0,wxTOP|wxLEFT,3);
	mbsizer1->Add(mbsizer4,0,wxTOP,5);
		//wxBoxSizer *mbsizer2 = new wxBoxSizer(wxHORIZONTAL);
		//	wxBoxSizer *mbsizer3 = new wxBoxSizer(wxVERTICAL);
		//mbsizer2->Add(mbsizer3,0,wxLEFT,5);
	mbsizer1->AddSpacer(5);
	mbsizer1->Add(ipt_CaseHolidayTiming,0,wxLEFT,5);
	//mbsizer1->Add(mbsizer2,0,wxTOP|wxLEFT,5);

	ipt_mainPanel->SetSizer(mbsizer1);
	ipt_mainPanel->Layout();

	ipt_OkBtn = new wxButton(this, input_ptran_ok, _T("OK"), wxPoint(-1,-1),wxSize(85,-1));
	ipt_CanBtn = new wxButton(this, input_ptran_can, _("Cancel"), wxPoint(-1,-1),wxSize(85,-1));
	
	de_dialog = new DetailEditor(this);
	wxBoxSizer *bsizer1 = new wxBoxSizer(wxVERTICAL);
		wxBoxSizer *bsizer2 = new wxBoxSizer(wxHORIZONTAL);
		bsizer2->Add(ipt_OkBtn,0,wxTOP|wxLEFT,0);
		bsizer2->Add(ipt_CanBtn,0,wxLEFT,5);
	bsizer1->Add(ipt_mainPanel,0,wxBOTTOM,5);
	bsizer1->Add(bsizer2,0,wxRIGHT|wxALIGN_RIGHT,10);
	this->SetSizer(bsizer1);
	this->Layout();
	isinputbase = false;
}
示例#9
0
CpicFrame::CpicFrame(wxFrame * parent, const char * buffer, int buffersize, int w, int h, char * title)
:wxFrame(parent, - 1, "")
{
    ptype=1;
    wxMemoryInputStream * mis = new wxMemoryInputStream(buffer, buffersize);
    image_jpg = new wxImage;
    image_jpg -> LoadFile( * mis, wxBITMAP_TYPE_ANY, - 1);
    imageXsize = image_jpg -> GetWidth();
    imageYsize = image_jpg -> GetHeight();
    imageXfsize = w;
    imageYfsize = h;
    imageXfpos = 0;
    imageYfpos = 0;
    mouseXpos = - 1;
    mouseYpos = - 1;
    if (imageXfsize == - 1)
    {
        imageXfsize = imageXsize;
    }
    else if(imageXfsize > (imageXsize))
    {
        imageXfsize = imageXsize;
    }
    if (imageYfsize == - 1)
    {
        imageYfsize = imageYsize;
    }
    else if(imageYfsize > (imageYsize))
    {
        imageYfsize = imageYsize;
    }
    sizer_root = new wxBoxSizer(wxVERTICAL);
    Xf = 0;
    Yf = 0;
    sb1x = NULL;
    sb1y = NULL;
    bitmap_jpg = new wxBitmap(image_jpg -> Scale(imageXsize, imageYsize));
    if (bitmap_jpg)
    {
        if (imageXfsize != imageXsize)
        {
            Yf = 16;
        }
        if (imageYfsize != imageYsize)
        {
            Xf = 16;
        }
        if (imageXfsize != imageXsize)
        {
            sb1x = new wxScrollBar(this, - 1, wxDefaultPosition, wxSize( - 1, Yf), wxSB_HORIZONTAL);
            sb1x -> SetScrollbar(0, imageXfsize + Xf, imageXsize, imageXfsize + Xf);
        }
        if (imageYfsize != imageYsize)
        {
            sb1y = new wxScrollBar(this, - 1, wxDefaultPosition, wxSize(Xf, - 1), wxSB_VERTICAL);
            sb1y -> SetScrollbar(0, imageYfsize + Yf, imageYsize, imageYfsize + Yf);
        }
        //printf("Xf,Yf=%d,%d %d,%d != %d,%d\n", Xf, Yf, imageXsize, imageYsize, imageXfsize, imageYfsize);
    }
    SetClientSize(imageXfsize + Xf, imageYfsize + Yf);
    SetSizeHints(imageXfsize + Xf, imageYfsize + Yf, imageXsize + Xf, imageYsize + Yf);
    if (sb1x)
    {
        sizer_root -> Add(sb1x, 0, wxGROW | wxALIGN_BOTTOM, 0);
    }
    if (sb1y)
    {
        sizer_root -> Add(sb1y, 1, wxALIGN_RIGHT, 0);
    }
    SetSizer(sizer_root);
    if (strlen(title))
    {
        SetTitle(title);
    }
    Connect( - 1, wxEVT_PAINT, WXOEF(wxPaintEventFunction) & CpicFrame::OnPaint);
    Connect( - 1, wxEVT_SCROLL_THUMBTRACK, WXOEF(wxScrollEventFunction) & CpicFrame::OnPaint);
    Connect( - 1, wxEVT_SCROLL_LINEUP, WXOEF(wxScrollEventFunction) & CpicFrame::OnPaint);
    Connect( - 1, wxEVT_SCROLL_LINEDOWN, WXOEF(wxScrollEventFunction) & CpicFrame::OnPaint);
    Connect( - 1, wxEVT_SCROLL_PAGEUP, WXOEF(wxScrollEventFunction) & CpicFrame::OnPaint);
    Connect( - 1, wxEVT_SCROLL_PAGEDOWN, WXOEF(wxScrollEventFunction) & CpicFrame::OnPaint);
    //Connect( - 1, wxEVT_MOTION, WXOEF(wxMouseEventFunction) & CpicFrame::OnMouseMotion);
    delete mis;
}