dashboard_incomplete_lol
chamanEiqbal
c_cpp
2 years ago
3.8 kB
8
Indexable
#ifndef DASHBOARD_H
#define DASHBOARD_H
#include <wx/wx.h>
#include <wx/notebook.h>
#include "components/MyNotebook.h"
class Dashboard : public wxFrame {
public:
Dashboard(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame(NULL, wxID_ANY, title, pos, size, wxDEFAULT_FRAME_STYLE || ~wxCAPTION) {
// Create a notebook control
notebook = new MyNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_LEFT);
notebook->SetThemeEnabled(false);
notebook->SetBackgroundColour(wxColor(0,0,0));
// Add panels to the notebook
/*PROFILE PANEL*/
wxPanel* profile_panel = new wxPanel(notebook, wxID_ANY);
wxBoxSizer *profile_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *chattertitle = new wxStaticText(profile_panel, wxID_ANY, "Chatterchums");
chattertitle->SetFont(wxFont(72, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_SEMIBOLD, false));
wxStaticText *chattersubtitle = new wxStaticText(profile_panel, wxID_ANY, "A place for chats!");
chattersubtitle->SetFont(wxFont(11, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
chattertitle->SetForegroundColour(wxColor(255, 255, 255));
chattersubtitle->SetForegroundColour(wxColor(69, 69, 69));
profile_sizer->Add(chattertitle, 0, wxTOP | wxLEFT, 10);
profile_sizer->Add(chattersubtitle, 0, wxTOP | wxLEFT, 20);
// add user info as text
wxStaticText *chatterusername = new wxStaticText(profile_panel, wxID_ANY, "Username: Mustafa");
chatterusername->SetFont(wxFont(24, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
chatterusername->SetForegroundColour(wxColor(255,255,255));
wxStaticText *chatterpw = new wxStaticText(profile_panel, wxID_ANY, "Password: 19232");
chatterpw->SetFont(wxFont(24, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
chatterpw->SetForegroundColour(wxColor(255,255,255));
profile_sizer->Add(chatterusername, 0, wxTOP, 25);
profile_sizer->Add(chatterpw, 0, wxTOP, 10);
wxButton *chatterlogout = new wxButton(profile_panel, wxID_ANY, "Logout");
chatterlogout->SetBackgroundColour(wxColor(0,0,0));
chatterlogout->SetForegroundColour(wxColor(100,209,10));
profile_sizer->Add(chatterlogout, 0, wxTOP | wxALIGN_CENTER_HORIZONTAL, 300);
profile_panel->SetSizer(profile_sizer);
notebook->AddPage(profile_panel, wxString::Format("My Profile"));
/*PROFILE PANEL END */
/* MYPOSTS SCROLL WINDOW */
/*MYPOSTS SCROLL WINDOW END */
// Create a sizer for the frame
wxBoxSizer* frameSizer = new wxBoxSizer(wxVERTICAL);
// Add the notebook to the frame sizer
frameSizer->Add(notebook, 1, wxEXPAND);
// Set the frame sizer
SetSizerAndFit(frameSizer);
// Bind the notebook page changing event
Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, &Dashboard::OnPageChanged, this);
}
void OnPageChanged(wxBookCtrlEvent& event) {
// Get the selected page index
int pageIndex = event.GetSelection();
// Hide the previous page
if (previousPageIndex >= 0) {
notebook->GetPage(previousPageIndex)->Hide();
}
// Show the selected page
notebook->GetPage(pageIndex)->Show();
// Update the previous page index
previousPageIndex = pageIndex;
Layout();
Refresh();
}
private:
MyNotebook* notebook;
int previousPageIndex = -1;
};
#endif
Editor is loading...