SHARE
TWEET

Untitled

a guest Jan 20th, 2019 23 in 243 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "com.h"
  2. #include "main.h"
  3. #include "graph.h"
  4.  
  5.  
  6. DECLARE_APP(yrStats);
  7.  
  8. IMPLEMENT_APP(yrStats);
  9.  
  10. BEGIN_EVENT_TABLE(mainFrame, wxFrame)
  11.     EVT_BUTTON(BUTTON_UPDATE, mainFrame::updateData)
  12. END_EVENT_TABLE()
  13.  
  14. /**
  15.  * Main function Start Up
  16.  */
  17.  
  18. bool yrStats::OnInit()
  19. {
  20.  
  21.     mainFrame* frame = new mainFrame(0L,
  22.                                     wxID_ANY,
  23.                                     wxT("Værstatistikk"),
  24.                                     wxDefaultPosition,
  25.                                     wxSize(961, 715),
  26.                                     wxCLOSE_BOX | wxDEFAULT_FRAME_STYLE |
  27.                                     wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxTAB_TRAVERSAL);
  28.  
  29.     frame->Show();
  30.  
  31.     return true;
  32. }
  33.  
  34. void mainFrame::updateData(wxCommandEvent& event)
  35. {
  36.    
  37.     wxDateTime currentdate = wxDateTime::Now();
  38.     wxDateTime date = setupDatePicker->GetDate();
  39.     wxString str = date.FormatISODate();
  40.    
  41.     if(date.IsLaterThan(currentdate)) {
  42.         wxMessageBox(wxT("Du kan ikke velge en dato frem i tid!"), wxT("Feil"), wxOK | wxICON_WARNING);
  43.         return;
  44.     }
  45.    
  46.     if(!date.IsValid()) {
  47.         return;
  48.     }
  49.    
  50.     graph gr;
  51.     gr.getGraphDataUpdate(str);
  52.     //gr.serie->UpdateY(5, 5);
  53.     //gr.dataset->DatasetChanged();
  54.    
  55. }
  56.  
  57. mainFrame::mainFrame(wxWindow* parent, wxWindowID id, const wxString& title,
  58.                     const wxPoint& pos, const wxSize& size, long style)
  59.                    
  60.     : wxFrame(parent, id, title, pos, size, style)
  61. {
  62.    
  63.     graph ob;
  64.     Chart* chart = ob.getGraph(wxT("Pølse"));
  65.    
  66.    
  67.    
  68.    
  69.    
  70.    
  71.    
  72.     this->SetSizeHints(wxSize(950, 800), wxDefaultSize);
  73.     this->SetBackgroundColour(wxColour(255, 255, 255));
  74.    
  75.     wxBoxSizer* sZmain;
  76.     wxBoxSizer* sZtop;
  77.     wxStaticBoxSizer* sZsetup1;
  78.     wxBoxSizer* sZsetup;
  79.     wxBoxSizer* sZsetup11;
  80.     wxBoxSizer* sZsetup111;
  81.     wxBoxSizer* sZsetup112;
  82.     wxBoxSizer* sZsetup12;
  83.     wxBoxSizer* sZsetup121;
  84.     wxBoxSizer* sZgraph;
  85.     wxBoxSizer* sZpanel1;
  86.     wxStaticBoxSizer* sZPanel11;
  87.     wxBoxSizer* sZpanel12;
  88.  
  89.     sZmain = new wxBoxSizer(wxVERTICAL);
  90.     sZtop = new wxBoxSizer(wxHORIZONTAL);
  91.     sZsetup = new wxBoxSizer(wxVERTICAL);
  92.     sZsetup11 = new wxBoxSizer(wxVERTICAL);
  93.     sZsetup111 = new wxBoxSizer(wxHORIZONTAL);
  94.     sZsetup112 = new wxBoxSizer(wxVERTICAL);
  95.     sZsetup12 = new wxBoxSizer(wxVERTICAL);
  96.     sZsetup121 = new wxBoxSizer(wxVERTICAL);
  97.     sZgraph = new wxBoxSizer(wxVERTICAL);
  98.     sZpanel1 = new wxBoxSizer(wxVERTICAL);
  99.     sZpanel12 = new wxBoxSizer(wxVERTICAL);
  100.  
  101.     titleText = new wxStaticText(this, wxID_ANY, wxT("Værstatistikk"), wxDefaultPosition, wxDefaultSize, 0);
  102.     sZsetup1 = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, wxT("Oppsett")), wxHORIZONTAL);
  103.     setupTextStation = new wxStaticText(sZsetup1->GetStaticBox(), wxID_ANY, wxT("Værstasjon:"), wxDefaultPosition, wxDefaultSize, 0);
  104.     setupStationChoice = new wxComboBox(sZsetup1->GetStaticBox(), wxID_ANY, wxT("---"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0);
  105.     setupDatePicker = new wxCalendarCtrl(sZsetup1->GetStaticBox(), wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_MONDAY_FIRST | wxCAL_SHOW_HOLIDAYS | wxCAL_SHOW_WEEK_NUMBERS);
  106.     setupUpdate = new wxButton(sZsetup1->GetStaticBox(), BUTTON_UPDATE, wxT("Oppdater"), wxDefaultPosition, wxDefaultSize, 0);
  107.     graphNotebook = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
  108.     graphPanel1 = new wxPanel(graphNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
  109.     grapPhanel2 = new wxPanel(graphNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
  110.     sZPanel11 = new wxStaticBoxSizer(new wxStaticBox(graphPanel1, wxID_ANY, wxT("Innstillinger for graf")), wxVERTICAL);
  111.     m_radioBtn1 = new wxRadioButton(sZPanel11->GetStaticBox(), wxID_ANY, wxT("RadioBtn"), wxDefaultPosition, wxDefaultSize, 0);
  112.     m_staticText7 = new wxStaticText(graphPanel1, wxID_ANY, wxT("TEST"), wxDefaultPosition, wxDefaultSize, 0);
  113.    
  114.     titleText->Wrap(-1);
  115.     titleText->SetFont(wxFont(26, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Roboto")));
  116.     m_staticText7->Wrap(-1);    
  117.     graphNotebook->AddPage(grapPhanel2, wxT("Tabell"), false);
  118.     setupTextStation->Wrap(-1);
  119.     graphNotebook->AddPage(graphPanel1, wxT("Temperaturgraf"), true);
  120.     sZtop->Add(titleText, 0, wxALL, 5);
  121.     sZmain->Add(sZtop, 0, wxEXPAND | wxLEFT, 5);
  122.     sZsetup111->Add(setupTextStation, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
  123.     sZsetup111->Add(setupStationChoice, 0, wxEXPAND, 5);
  124.     sZsetup11->Add(sZsetup111, 0, wxBOTTOM | wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
  125.     sZsetup112->Add(setupDatePicker, 0, wxALL, 5);
  126.     sZsetup11->Add(sZsetup112, 1, wxLEFT | wxRIGHT, 5);
  127.     sZsetup1->Add(sZsetup11, 1, wxEXPAND, 5);
  128.     sZsetup121->Add(setupUpdate, 0, wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL | wxALL, 5);
  129.     sZsetup12->Add(sZsetup121, 1, wxALIGN_LEFT, 5);
  130.     sZsetup1->Add(sZsetup12, 0, 0, 5);
  131.     sZsetup->Add(sZsetup1, 1, wxLEFT | wxRIGHT, 5);
  132.     sZmain->Add(sZsetup, 0, wxALL, 5);
  133.     sZPanel11->Add(m_radioBtn1, 0, wxALL, 5);
  134.     sZpanel1->Add(sZPanel11, 0, wxALL | wxEXPAND, 5);
  135.     //sZpanel12->Add(m_staticText7, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
  136.    
  137.     wxChartPanel *chartPanel = new wxChartPanel(graphPanel1);
  138.     chartPanel->SetAntialias(true);
  139.    
  140.     sZpanel12->Add(chartPanel, 1, wxEXPAND | wxALL, 5);
  141.    
  142.     chartPanel->SetChart(chart);
  143.    
  144.     sZpanel1->Add(sZpanel12, 1, wxEXPAND, 5);
  145.     sZgraph->Add(graphNotebook, 1, wxEXPAND | wxALL, 5);
  146.     sZmain->Add(sZgraph, 1, wxALL | wxEXPAND, 5);
  147.  
  148.     graphPanel1->SetSizer(sZpanel1);
  149.     graphPanel1->Layout();
  150.     sZpanel1->Fit(graphPanel1);
  151.    
  152.     this->SetSizer(sZmain);
  153.     this->Layout();
  154.  
  155.     this->Centre(wxBOTH);
  156. }
  157.  
  158. mainFrame::~mainFrame()
  159. {
  160. }
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