Created
February 4, 2017 18:50
-
-
Save andr1972/3e73d899da4333e68b4d019c21882e0a to your computer and use it in GitHub Desktop.
Control expand in one instead of two directons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef WX_PRECOMP | |
#include "wx_pch.h" | |
#endif | |
#ifdef __BORLANDC__ | |
#pragma hdrstop | |
#endif //__BORLANDC__ | |
#include "booksApp.h" | |
#include "booksMain.h" | |
IMPLEMENT_APP(booksApp); | |
bool booksApp::OnInit() | |
{ | |
booksMain* frame = new booksMain(_("Books MySQL")); | |
frame->SetIcon(wxICON(appIcon)); // To Set App Icon | |
frame->Show(); | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <wx/app.h> | |
class booksApp : public wxApp | |
{ | |
public: | |
virtual bool OnInit(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef WX_PRECOMP | |
#include "wx_pch.h" | |
#endif | |
#ifdef __BORLANDC__ | |
#pragma hdrstop | |
#endif //__BORLANDC__ | |
#include "booksMain.h" | |
//helper functions | |
enum wxbuildinfoformat { | |
short_f, long_f }; | |
wxString wxbuildinfo(wxbuildinfoformat format) | |
{ | |
wxString wxbuild(wxVERSION_STRING); | |
if (format == long_f ) | |
{ | |
#if defined(__WXMSW__) | |
wxbuild << _T("-Windows"); | |
#elif defined(__WXMAC__) | |
wxbuild << _T("-Mac"); | |
#elif defined(__UNIX__) | |
wxbuild << _T("-Linux"); | |
#endif | |
#if wxUSE_UNICODE | |
wxbuild << _T("-Unicode build"); | |
#else | |
wxbuild << _T("-ANSI build"); | |
#endif // wxUSE_UNICODE | |
} | |
return wxbuild; | |
} | |
BEGIN_EVENT_TABLE(booksMain, wxFrame) | |
EVT_CLOSE(booksMain::OnClose) | |
EVT_BUTTON(idBtnQuit, booksMain::OnQuit) | |
EVT_BUTTON(idBtnAbout, booksMain::OnAbout) | |
END_EVENT_TABLE() | |
booksMain::booksMain(const wxString &title) | |
: wxFrame(NULL, wxID_ANY, title) | |
{ | |
this->SetSizeHints(wxDefaultSize, wxDefaultSize); | |
wxBoxSizer* bSizer2; | |
bSizer2 = new wxBoxSizer(wxHORIZONTAL); | |
BtnAbout = new wxButton(this, idBtnAbout, wxT("&About"), wxDefaultPosition, wxDefaultSize, 0); | |
bSizer2->Add(BtnAbout, 0, wxALL, 5); | |
BtnQuit = new wxButton(this, idBtnQuit, wxT("&Quit"), wxDefaultPosition, wxDefaultSize, 0); | |
bSizer2->Add(BtnQuit, 0, wxALL, 5); | |
ListView = new wxListView(this, idListView, wxDefaultPosition, wxSize(250, 200)); | |
ListView->AppendColumn("Column 1"); | |
ListView->InsertItem(0, "Item 1"); | |
ListView->InsertItem(1, "Item 2"); | |
ListView->InsertItem(2, "Item 3"); | |
bSizer2->Add(ListView, 0, wxEXPAND, 5); | |
this->SetSizer(bSizer2); | |
this->Layout(); | |
bSizer2->Fit(this); | |
} | |
booksMain::~booksMain() | |
{ | |
} | |
void booksMain::OnClose(wxCloseEvent &event) | |
{ | |
Destroy(); | |
} | |
void booksMain::OnQuit(wxCommandEvent &event) | |
{ | |
Destroy(); | |
} | |
void booksMain::OnAbout(wxCommandEvent &event) | |
{ | |
wxString msg = wxbuildinfo(long_f); | |
wxMessageBox(msg, _("Welcome to...")); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#ifndef WX_PRECOMP | |
#include <wx/wx.h> | |
#endif | |
#include "booksApp.h" | |
#include <wx/button.h> | |
#include <wx/statline.h> | |
#include <wx/listctrl.h> | |
class booksMain: public wxFrame | |
{ | |
private: | |
void OnClose(wxCloseEvent& event); | |
void OnQuit(wxCommandEvent& event); | |
void OnAbout(wxCommandEvent& event); | |
DECLARE_EVENT_TABLE() | |
protected: | |
enum | |
{ | |
idBtnQuit = 1000, | |
idBtnAbout, | |
idListView | |
}; | |
wxButton* BtnAbout; | |
wxButton* BtnQuit; | |
wxListView *ListView; | |
public: | |
booksMain(const wxString& title); | |
~booksMain(); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment