'How do I make my own window frame in egui (eframe) Rust

Here is how I start my app and remove the window frame:

    let app = RustClicker::default();
    let mut native_options = eframe::NativeOptions::default();
    native_options.decorated = false; // I remove window frame here
    eframe::run_native(Box::new(app), native_options);

I made my own top-panel like this:

        egui::TopBottomPanel::top("decoration").show(ctx, |ui| {
            egui::menu::bar(ui, |ui| {
                ui.with_layout(egui::Layout::left_to_right(), |ui| {
                    ui.label("🖱");
                });

                ui.with_layout(egui::Layout::right_to_left(), |ui| {
                    if ui.button("🗙").clicked() {
                        frame.quit();
                    }
                    let change_theme = ui.button("🎨");
                    if change_theme.clicked() {
                        if self.dark_theme {
                            self.dark_theme = false;
                        }
                        else {
                            self.dark_theme = true;
                        }
                    }
                });
            });
        });

But I can't move it with holding moue button on, TopPanel is there anyway to fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source