<commit_before>extern crate kiss_ui;

use kiss_ui::button::Button;
use kiss_ui::container::Horizontal;
use kiss_ui::callback::OnClick;
use kiss_ui::dialog::Dialog;
use kiss_ui::text::Label;

fn main() {
    kiss_ui::show_gui(||
        Dialog::new(Horizontal::new(|builder|{
            builder.add_child(
                Button::new()
                    .set_label(Some("Click me!"))
                    .set_onclick(show_new_dialog) 
            );
        }))
        .set_title("Button test!")
        .set_size_pixels(280, 140)
    );
}

fn show_new_dialog(_: Button) {
    println!("Button clicked!");

    Dialog::new(Label::new("You clicked the button!"))
        .set_title("Button clicked!")
        .set_size_pixels(180, 90)
        .show();
}<commit_msg>Add close button to button test dialog<commit_after>extern crate kiss_ui;

use kiss_ui::button::Button;
use kiss_ui::container::Horizontal;
use kiss_ui::callback::{OnClick, CallbackStatus};
use kiss_ui::dialog::Dialog;
use kiss_ui::text::Label;

fn main() {
    kiss_ui::show_gui(||
        Dialog::new(Horizontal::new(|builder|{
            builder.add_child(
                Button::new()
                    .set_label(Some("Click me!"))
                    .set_onclick(show_new_dialog) 
            )
            .add_child(
                Button::new()
                    .set_label(Some("Close"))
                    .set_onclick(close_dialog)
            );
        }))
        .set_title("Button test!")
        .set_size_pixels(140, 70)
    );
}

fn show_new_dialog(_: Button) {
    println!("Button clicked!");

    Dialog::new(Label::new("You clicked the button!"))
        .set_title("Button clicked!")
        .set_size_pixels(180, 90)
        .show();
}

fn close_dialog(_: Button) {
    println!("Closing dialog!");
    CallbackStatus::Close.set();
}
{'fraction_non_alphanumeric': 0.14931880108991827, 'fraction_numerical': 0.011444141689373298, 'mean_word_length': 2.425373134328358, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1967086', 'n_tokens_mistral': 600, 'n_tokens_neox': 566, 'n_words': 97}