You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ruler.rs
    path of file: ./repos/Fyrox/editor/src/animation
    
    the code of the file until where you have to start completion: use crate::menu::create_menu_item;
use fyrox::graph::BaseSceneGraph;
use fyrox::{
    core::{
        algebra::{Matrix3, Point2, Vector2},
        math::{round_to_step, Rect},
        pool::Handle,
        reflect::prelude::*,
        type_traits::prelude::*,
        uuid::Uuid,
        uuid_provider,
        visitor::prelude::*,
    },
    gui::{
        define_constructor, define_widget_deref,
        draw::{CommandTexture, Draw, DrawingContext},
        formatted_text::{FormattedText, FormattedTextBuilder},
        menu::MenuItemMessage,
        message::{MessageDirection, MouseButton, UiMessage},
        popup::PopupBuilder,
        popup::{Placement, PopupMessage},
        stack_panel::StackPanelBuilder,
        widget::{Widget, WidgetBuilder, WidgetMessage},
        BuildContext, Control, RcUiNodeHandle, UiNode, UserInterface, BRUSH_BRIGHT, BRUSH_DARKER,
        BRUSH_LIGHTER, BRUSH_LIGHTEST,
    },
};
use std::{
    cell::{Cell, RefCell},
    fmt::{Debug, Formatter},
    ops::{Deref, DerefMut},
};

#[derive(Debug, Clone, PartialEq)]
pub enum RulerMessage {
    Zoom(f32),
    ViewPosition(f32),
    Value(f32),
    AddSignal(f32),
    RemoveSignal(Uuid),
    SyncSignals(Vec<SignalView>),
    MoveSignal { id: Uuid, new_position: f32 },
    Sele
    
    fn preview_message(&self, ui: &UserInterface, message: &mut UiMessage) {
        if let Some(MenuItemMessage::Click) = message.data() {
            if message.destination() == self.context_menu.add_signal {
                ui.send_message(RulerMessage::add_signal(
                    self.handle,
                    MessageDirection::FromWidget,
                    self.context_menu.selected_position.get(),
                ));
            } else if message.destination() == self.context_menu.remove_signal {
                for signal in self.signals.borrow().iter() {
                    if signal
                        .screen_bounds(self)
                        .contains(ui.node(self.context_menu.menu.handle()).screen_position())
                    {
                        ui.send_message(RulerMessage::remove_signal(
                            self.handle,
                            MessageDirection::FromWidget,
                            signal.id,
                        ));
                        break; // No multi-selection
                    }
                }
            }
        } else if let Some(PopupMessage::Placement(Placement::Cursor(_))) = message.data() {
            self.context_menu
                .selected_position
                .set(self.screen_to_value_space(ui.cursor_position().x));

            let can_remove = self
                .signals
                .borrow()
                .iter()
                .any(|signal| signal.screen_bounds(self).contains(ui.cursor_position()));

            ui.send_message(WidgetMessage::enabled(
                self.context_menu.remove_signal,
                MessageDirection::ToWidget,
                can_remove,
            ));
        }
    }