Maraiah/tycho/source/gui/mapview.rs

54 lines
1.2 KiB
Rust

//! Map view.
use super::qobj::*;
use crate::cc;
impl IMapViewTrait for IMapView
{
/// Returns a new `IMapView` instance.
fn new(emit: IMapViewEmitter) -> Self
{
if cfg!(debug_assertions) {
eprintln!("new IMapView");
}
Self{emit}
}
/// Returns the emitter of `self`.
fn emit(&mut self) -> &mut IMapViewEmitter {&mut self.emit}
fn draw_view(&self, paint: *mut cc::QPainter)
{
cc::paint_fg(paint, 0, 255, 0, 255);
cc::paint_arc(paint, 30, 30, 100, 100, 77, 440);
cc::paint_chord(paint, 50, 50, 100, 100, 77, 440);
cc::paint_ellipse(paint, 80, 80, 30, 30);
cc::paint_image(paint, 200, 10, ":/tycho/images/tycho1.png");
cc::paint_line(paint, 100, 60, 140, 100);
cc::paint_point(paint, 20, 20);
cc::paint_polygon(paint, &[cc::Int2{x: 250, y: 170},
cc::Int2{x: 270, y: 190},
cc::Int2{x: 230, y: 190}]);
cc::paint_rect(paint, 150, 170, 20, 20);
cc::paint_squircle(paint, 90, 170, 30, 30, 7, 9);
cc::paint_text(paint, 50, 50, "hello, world");
}
}
impl Drop for IMapView
{
fn drop(&mut self)
{
if cfg!(debug_assertions) {
eprintln!("drop IMapView");
}
}
}
pub struct IMapView {
emit: IMapViewEmitter,
}
// EOF