Первая версия тулбара
This commit is contained in:
@@ -9,11 +9,13 @@ const Size_i = basic_models.Size_i;
|
||||
const Point2_f = @import("models/basic_models.zig").Point2_f;
|
||||
const Color = dvui.Color;
|
||||
|
||||
const Toolbar = @import("Toolbar.zig");
|
||||
const Canvas = @This();
|
||||
|
||||
allocator: std.mem.Allocator,
|
||||
document: *Document,
|
||||
render_engine: RenderEngine,
|
||||
toolbar: Toolbar,
|
||||
texture: ?dvui.Texture = null,
|
||||
pos: dvui.Point = dvui.Point{ .x = 400, .y = 400 },
|
||||
scroll: dvui.ScrollInfo = .{
|
||||
@@ -30,15 +32,17 @@ cursor_document_point: ?Point2_f = null,
|
||||
/// true — рисовать документ (render), false — пример (gradient/squares).
|
||||
draw_document: bool = true,
|
||||
|
||||
pub fn init(allocator: std.mem.Allocator, document: *Document, engine: RenderEngine) Canvas {
|
||||
pub fn init(allocator: std.mem.Allocator, document: *Document, engine: RenderEngine, toolbar: Toolbar) Canvas {
|
||||
return .{
|
||||
.allocator = allocator,
|
||||
.document = document,
|
||||
.render_engine = engine,
|
||||
.toolbar = toolbar,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Canvas) void {
|
||||
self.toolbar.deinit();
|
||||
if (self.texture) |texture| {
|
||||
dvui.Texture.destroyLater(texture);
|
||||
self.texture = null;
|
||||
|
||||
Reference in New Issue
Block a user