Skip to content

Commit

Permalink
library: Add rust demo calendar (#581)
Browse files Browse the repository at this point in the history
* library: Add rust demo calendar

* library: address comments

* Update src/Library/demos/Calendar/code.rs

Co-authored-by: Hofer-Julian <[email protected]>

* Update src/Library/demos/Calendar/code.rs

Co-authored-by: Hofer-Julian <[email protected]>

* Update src/Library/demos/Calendar/code.rs

Co-authored-by: Hofer-Julian <[email protected]>

* Update src/Library/demos/Calendar/code.rs

Co-authored-by: Hofer-Julian <[email protected]>

---------

Co-authored-by: Hofer-Julian <[email protected]>
  • Loading branch information
M-Sabrina and Hofer-Julian authored Sep 8, 2023
1 parent 7b0f9b4 commit 2a559b5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Library/demos/Calendar/code.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use crate::workbench;

pub fn main() {
let calendar: gtk::Calendar = workbench::builder().object("calendar").unwrap();

calendar.connect_day_notify(|calendar| {
println!("{}", calendar.date().format("%e").unwrap());
});

calendar.connect_month_notify(|calendar| {
println!("{}", calendar.date().format("%B").unwrap());
});

calendar.connect_year_notify(|calendar| {
println!("{}", calendar.date().format("%Y").unwrap());
});

calendar.connect_day_selected(|calendar| {
println!("{}", calendar.date().format_iso8601().unwrap());
});

calendar.mark_day(15);
}

0 comments on commit 2a559b5

Please sign in to comment.