ezgl  1.0.1
An Easy Graphics & GUI Library
control.hpp
1 /*
2  * Copyright 2019-2022 University of Toronto
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * Authors: Mario Badr, Sameh Attia, Tanner Young-Schultz and Vaughn Betz
17  */
18 
19 #ifndef EZGL_CONTROL_HPP
20 #define EZGL_CONTROL_HPP
21 
22 #include "ezgl/point.hpp"
23 #include "ezgl/rectangle.hpp"
24 
25 namespace ezgl {
26 
27 /**** Functions to manipulate what is visible on the screen; used by ezgl's predefined buttons. ****/
28 /**** Application code does not have to ever call these functions. ****/
29 
30 class canvas;
31 
35 void zoom_in(canvas *cnv, double zoom_factor);
36 
40 void zoom_out(canvas *cnv, double zoom_factor);
41 
45 void zoom_in(canvas *cnv, point2d zoom_point, double zoom_factor);
46 
50 void zoom_out(canvas *cnv, point2d zoom_point, double zoom_factor);
51 
55 void zoom_fit(canvas *cnv, rectangle region);
56 
60 void translate(canvas *cnv, double dx, double dy);
61 
65 void translate_up(canvas *cnv, double translate_factor);
66 
70 void translate_down(canvas *cnv, double translate_factor);
71 
75 void translate_left(canvas *cnv, double translate_factor);
76 
80 void translate_right(canvas *cnv, double translate_factor);
81 }
82 
83 #endif //EZGL_CONTROL_HPP
Responsible for creating, destroying, and maintaining the rendering context of a GtkWidget.
Definition: canvas.hpp:54
Represents a two-dimensional point.
Definition: point.hpp:27
Represents a rectangle as two diagonally opposite points.
Definition: rectangle.hpp:31
A library for creating a graphical user interface.
Definition: application.hpp:40
void translate_down(canvas *cnv, double translate_factor)
Translate down.
void zoom_in(canvas *cnv, double zoom_factor)
Zoom in on the center of the currently visible world.
void translate(canvas *cnv, double dx, double dy)
Translate by delta x and delta y (dx, dy)
void zoom_out(canvas *cnv, double zoom_factor)
Zoom out from the center of the currently visible world.
void translate_right(canvas *cnv, double translate_factor)
Translate right.
void translate_left(canvas *cnv, double translate_factor)
Translate left.
void zoom_fit(canvas *cnv, rectangle region)
Zoom in or out to fit an exact region of the world.
void translate_up(canvas *cnv, double translate_factor)
Translate up.