SHARE
TWEET

Untitled

a guest Jul 24th, 2011 410 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /***************************************************************
  2.  * Name:      CodeBlocksBSDMain.cpp
  3.  * Purpose:   Code for Application Frame
  4.  * Author:    Alexandr A Alexeev
  5.  * Created:   2011-02-28
  6.  * Copyright: afiskon (http://eax.me/)
  7.  * License:
  8.  **************************************************************/
  9.  
  10. #include "CodeBlocksBSDMain.h"
  11. #include <wx/msgdlg.h>
  12.  
  13. //(*InternalHeaders(CodeBlocksBSDFrame)
  14. #include <wx/settings.h>
  15. #include <wx/intl.h>
  16. #include <wx/string.h>
  17. //*)
  18.  
  19. //helper functions
  20. enum wxbuildinfoformat {
  21.     short_f, long_f };
  22.  
  23. wxString wxbuildinfo(wxbuildinfoformat format)
  24. {
  25.     wxString wxbuild(wxVERSION_STRING);
  26.  
  27.     if (format == long_f )
  28.     {
  29. #if defined(__WXMSW__)
  30.         wxbuild << _T("-Windows");
  31. #elif defined(__UNIX__)
  32.         wxbuild << _T("-Linux");
  33. #endif
  34.  
  35. #if wxUSE_UNICODE
  36.         wxbuild << _T("-Unicode build");
  37. #else
  38.         wxbuild << _T("-ANSI build");
  39. #endif // wxUSE_UNICODE
  40.     }
  41.  
  42.     return wxbuild;
  43. }
  44.  
  45. //(*IdInit(CodeBlocksBSDFrame)
  46. const long CodeBlocksBSDFrame::ID_TEXTCTRL1 = wxNewId();
  47. const long CodeBlocksBSDFrame::ID_SLIDER1 = wxNewId();
  48. const long CodeBlocksBSDFrame::ID_BUTTON6 = wxNewId();
  49. const long CodeBlocksBSDFrame::ID_BUTTON7 = wxNewId();
  50. const long CodeBlocksBSDFrame::ID_BUTTON8 = wxNewId();
  51. const long CodeBlocksBSDFrame::ID_BUTTON10 = wxNewId();
  52. const long CodeBlocksBSDFrame::ID_SLIDER2 = wxNewId();
  53. const long CodeBlocksBSDFrame::ID_CHECKBOX1 = wxNewId();
  54. const long CodeBlocksBSDFrame::ID_CHECKBOX3 = wxNewId();
  55. const long CodeBlocksBSDFrame::ID_CHECKBOX4 = wxNewId();
  56. const long CodeBlocksBSDFrame::ID_LISTBOX1 = wxNewId();
  57. const long CodeBlocksBSDFrame::ID_BUTTON1 = wxNewId();
  58. const long CodeBlocksBSDFrame::ID_BUTTON2 = wxNewId();
  59. const long CodeBlocksBSDFrame::ID_BUTTON3 = wxNewId();
  60. const long CodeBlocksBSDFrame::ID_BUTTON4 = wxNewId();
  61. const long CodeBlocksBSDFrame::ID_BUTTON5 = wxNewId();
  62. //*)
  63.  
  64. BEGIN_EVENT_TABLE(CodeBlocksBSDFrame,wxFrame)
  65.     //(*EventTable(CodeBlocksBSDFrame)
  66.     //*)
  67. END_EVENT_TABLE()
  68.  
  69. CodeBlocksBSDFrame::CodeBlocksBSDFrame(wxWindow* parent,wxWindowID id)
  70. {
  71.     //(*Initialize(CodeBlocksBSDFrame)
  72.     wxBoxSizer* BoxSizer6;
  73.     wxBoxSizer* BoxSizer8;
  74.     wxBoxSizer* BoxSizer2;
  75.     wxBoxSizer* BoxSizer1;
  76.     wxBoxSizer* BoxSizer9;
  77.     wxBoxSizer* BoxSizer3;
  78.    
  79.     Create(parent, wxID_ANY, _("eaxPlayer"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
  80.     BoxSizer1 = new wxBoxSizer(wxVERTICAL);
  81.     BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
  82.     txtTitle = new wxTextCtrl(this, ID_TEXTCTRL1, _("Welcome to eaxPlayer!"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxNO_BORDER, wxDefaultValidator, _T("ID_TEXTCTRL1"));
  83.     txtTitle->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWFRAME));
  84.     txtTitle->SetToolTip(_("Title"));
  85.     BoxSizer2->Add(txtTitle, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  86.     sldrVolume = new wxSlider(this, ID_SLIDER1, 100, 0, 100, wxDefaultPosition, wxSize(94,16), 0, wxDefaultValidator, _T("ID_SLIDER1"));
  87.     sldrVolume->SetToolTip(_("Volume - 100%"));
  88.     BoxSizer2->Add(sldrVolume, 0, wxALL|wxEXPAND|wxSHAPED|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  89.     BoxSizer1->Add(BoxSizer2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
  90.     BoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
  91.     BoxSizer9 = new wxBoxSizer(wxHORIZONTAL);
  92.     btnFirst = new wxButton(this, ID_BUTTON6, _("|<"), wxDefaultPosition, wxSize(30,30), 0, wxDefaultValidator, _T("ID_BUTTON6"));
  93.     btnFirst->SetToolTip(_("First"));
  94.     BoxSizer9->Add(btnFirst, 0, wxALL|wxSHAPED|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  95.     btnPlay = new wxButton(this, ID_BUTTON7, _(">"), wxDefaultPosition, wxSize(30,30), 0, wxDefaultValidator, _T("ID_BUTTON7"));
  96.     btnPlay->SetToolTip(_("Play"));
  97.     BoxSizer9->Add(btnPlay, 0, wxALL|wxSHAPED|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  98.     btnPause = new wxButton(this, ID_BUTTON8, _("||"), wxDefaultPosition, wxSize(30,30), 0, wxDefaultValidator, _T("ID_BUTTON8"));
  99.     btnPause->SetToolTip(_("Pause"));
  100.     BoxSizer9->Add(btnPause, 0, wxALL|wxSHAPED|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  101.     btnLast = new wxButton(this, ID_BUTTON10, _(">|"), wxDefaultPosition, wxSize(30,30), 0, wxDefaultValidator, _T("ID_BUTTON10"));
  102.     btnLast->SetToolTip(_("Last"));
  103.     BoxSizer9->Add(btnLast, 0, wxALL|wxSHAPED|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  104.     BoxSizer8->Add(BoxSizer9, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
  105.     sldrPosition = new wxSlider(this, ID_SLIDER2, 0, 0, 100, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_SLIDER2"));
  106.     sldrPosition->SetToolTip(_("Position - 00:00"));
  107.     BoxSizer8->Add(sldrPosition, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  108.     BoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
  109.     chbLoop = new wxCheckBox(this, ID_CHECKBOX1, _("L"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
  110.     chbLoop->SetValue(false);
  111.     chbLoop->SetToolTip(_("Loop"));
  112.     BoxSizer3->Add(chbLoop, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  113.     chbRandom = new wxCheckBox(this, ID_CHECKBOX3, _("R"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX3"));
  114.     chbRandom->SetValue(false);
  115.     chbRandom->SetToolTip(_("Random"));
  116.     BoxSizer3->Add(chbRandom, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  117.     chbMute = new wxCheckBox(this, ID_CHECKBOX4, _("M"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX4"));
  118.     chbMute->SetValue(false);
  119.     chbMute->SetToolTip(_("Mute"));
  120.     BoxSizer3->Add(chbMute, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  121.     BoxSizer8->Add(BoxSizer3, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 1);
  122.     BoxSizer1->Add(BoxSizer8, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  123.     ListBox1 = new wxListBox(this, ID_LISTBOX1, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1"));
  124.     ListBox1->SetToolTip(_("Playlist"));
  125.     BoxSizer1->Add(ListBox1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  126.     BoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
  127.     btnAdd = new wxButton(this, ID_BUTTON1, _("Add"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
  128.     btnAdd->SetToolTip(_("Add"));
  129.     BoxSizer6->Add(btnAdd, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  130.     btnDel = new wxButton(this, ID_BUTTON2, _("Delete"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
  131.     btnDel->SetToolTip(_("Delete"));
  132.     BoxSizer6->Add(btnDel, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  133.     btnSave = new wxButton(this, ID_BUTTON3, _("Save"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3"));
  134.     btnSave->SetToolTip(_("Save playlist"));
  135.     BoxSizer6->Add(btnSave, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  136.     btnOpen = new wxButton(this, ID_BUTTON4, _("Open"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4"));
  137.     btnOpen->SetToolTip(_("Open playlist"));
  138.     BoxSizer6->Add(btnOpen, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  139.     btnOpenUrl = new wxButton(this, ID_BUTTON5, _("Open URL"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON5"));
  140.     btnOpenUrl->SetToolTip(_("Open URL"));
  141.     BoxSizer6->Add(btnOpenUrl, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
  142.     BoxSizer1->Add(BoxSizer6, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
  143.     SetSizer(BoxSizer1);
  144.     BoxSizer1->Fit(this);
  145.     BoxSizer1->SetSizeHints(this);
  146.     //*)
  147. }
  148.  
  149. CodeBlocksBSDFrame::~CodeBlocksBSDFrame()
  150. {
  151.     //(*Destroy(CodeBlocksBSDFrame)
  152.     //*)
  153. }
  154.  
  155. void CodeBlocksBSDFrame::OnQuit(wxCommandEvent& event)
  156. {
  157.     Close();
  158. }
  159.  
  160. void CodeBlocksBSDFrame::OnAbout(wxCommandEvent& event)
  161. {
  162.     wxString msg = wxbuildinfo(long_f);
  163.     wxMessageBox(msg, _("Welcome to..."));
  164. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top