aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-06-29 20:58:01 -0600
committerMelody Horn <melody@boringcactus.com>2021-06-29 20:58:01 -0600
commit6905609cfe9baf945f1e3765876d6f45d860881d (patch)
tree8e29219b803ee8d9b872ca405a36f57d3a931a2a /src
parent756fd8977577d98ecc20babd7dad61324e6b4ecd (diff)
downloadriir-wxwidgets-6905609cfe9baf945f1e3765876d6f45d860881d.tar.gz
riir-wxwidgets-6905609cfe9baf945f1e3765876d6f45d860881d.zip
partially translate hello worldHEADcanon
i'm realizing that there's no fucking way i can automate the translation
Diffstat (limited to 'src')
-rw-r--r--src/main.rs76
1 files changed, 75 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 732805c..b2207a6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,5 @@
use std::env::{current_dir, set_current_dir};
-use std::fs::{create_dir_all, metadata, read_to_string};
+use std::fs::{create_dir_all, metadata, read_to_string, write};
use std::path::Path;
use std::process::Command;
@@ -64,6 +64,80 @@ fn main() {
assert!(cargo_new.success());
}
+ // we're putting the hello world example out here because yolo
+ create_dir_all("new/examples").unwrap();
+ write(
+ "new/examples/hello_world.rs",
+ r#"
+// wxWidgets "Hello World" Program
+
+struct MyApp;
+impl wx::App for MyApp {
+ fn on_init() {
+ let frame = MyFrame::new();
+ frame.show(true);
+ }
+}
+
+struct MyFrame {
+ base: wx::FrameBase,
+}
+impl wx::Frame for MyFrame {
+ fn new() -> Self {
+ let base = wx::FrameBase::new(None, wx::Id::Any, "Hello World");
+
+ let file_menu = wx::Menu::new();
+
+}
+
+wx::main!(MyApp);
+
+class MyFrame : public wxFrame
+{
+public:
+ MyFrame();
+private:
+ void OnHello(wxCommandEvent& event);
+ void OnExit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+};
+MyFrame::MyFrame()
+ : wxFrame(NULL, wxID_ANY, "Hello World")
+{
+ wxMenu *menuFile = new wxMenu;
+ menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
+ "Help string shown in status bar for this menu item");
+ menuFile->AppendSeparator();
+ menuFile->Append(wxID_EXIT);
+ wxMenu *menuHelp = new wxMenu;
+ menuHelp->Append(wxID_ABOUT);
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(menuFile, "&File");
+ menuBar->Append(menuHelp, "&Help");
+ SetMenuBar( menuBar );
+ CreateStatusBar();
+ SetStatusText("Welcome to wxWidgets!");
+ Bind(wxEVT_MENU, &MyFrame::OnHello, this, ID_Hello);
+ Bind(wxEVT_MENU, &MyFrame::OnAbout, this, wxID_ABOUT);
+ Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
+}
+void MyFrame::OnExit(wxCommandEvent& event)
+{
+ Close(true);
+}
+void MyFrame::OnAbout(wxCommandEvent& event)
+{
+ wxMessageBox("This is a wxWidgets Hello World example",
+ "About Hello World", wxOK | wxICON_INFORMATION);
+}
+void MyFrame::OnHello(wxCommandEvent& event)
+{
+ wxLogMessage("Hello world from wxWidgets!");
+}
+"#,
+ )
+ .unwrap();
+
let wx_h_text = read_to_string("orig/include/wx/wx.h").unwrap();
let lib_root_h = parse::parse(&wx_h_text);
dbg!(lib_root_h);