Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
toy-framework-2.h File Reference

Go to the source code of this file.

Classes

struct  colour
 
class  Handle
 
class  Toggle
 
class  VectorHandle< T >
 
class  PointHandle
 
class  PointSetHandle
 
class  RectHandle
 
class  Slider
 
class  Toy
 
class  Timer
 
class  Timer::Time
 

Functions

double uniform ()
 
void draw_text (cairo_t *cr, Geom::Point pos, const char *txt, bool bottom=false, const char *fontdesc="Sans")
 
void draw_text (cairo_t *cr, Geom::Point pos, const std::string &txt, bool bottom=false, const std::string &fontdesc="Sans")
 
void draw_number (cairo_t *cr, Geom::Point pos, int num, std::string name=std::string(), bool bottom=true)
 
void draw_number (cairo_t *cr, Geom::Point pos, unsigned num, std::string name=std::string(), bool bottom=true)
 
void draw_number (cairo_t *cr, Geom::Point pos, double num, std::string name=std::string(), bool bottom=true)
 
void cairo_set_source_rgba (cairo_t *cr, colour c)
 
std::string default_formatter (double x)
 
void redraw ()
 
void take_screenshot (const char *file)
 
void init (int argc, char **argv, Toy *t, int width=600, int height=600)
 
void toggle_events (std::vector< Toggle > &ts, Geom::Point const &pos, unsigned button)
 
void draw_toggles (cairo_t *cr, std::vector< Toggle > &ts)
 
Geom::Point read_point (FILE *f)
 
void get_clipboard_text (std::function< void(char const *)> &&on_completion)
 
std::ostream & operator<< (std::ostream &o, Timer::Time const &t)
 

Variables

const long long NS_PER_SECOND = 1000000000LL
 
const long long NS_PER_NS = 1
 

Function Documentation

◆ cairo_set_source_rgba()

◆ default_formatter()

std::string default_formatter ( double  x)
inline

Definition at line 212 of file toy-framework-2.h.

Referenced by angle_formatter(), and exp_formatter().

◆ draw_number() [1/3]

void draw_number ( cairo_t cr,
Geom::Point  pos,
double  num,
std::string  name = std::string(),
bool  bottom = true 
)

Definition at line 155 of file toy-framework-2.cpp.

References draw_text(), name, and num.

◆ draw_number() [2/3]

void draw_number ( cairo_t cr,
Geom::Point  pos,
int  num,
std::string  name = std::string(),
bool  bottom = true 
)

Definition at line 139 of file toy-framework-2.cpp.

References draw_text(), name, and num.

Referenced by PointSetHandle::draw().

◆ draw_number() [3/3]

void draw_number ( cairo_t cr,
Geom::Point  pos,
unsigned  num,
std::string  name = std::string(),
bool  bottom = true 
)

Definition at line 147 of file toy-framework-2.cpp.

References draw_text(), name, and num.

◆ draw_text() [1/2]

void draw_text ( cairo_t cr,
Geom::Point  pos,
const char *  txt,
bool  bottom = false,
const char *  fontdesc = "Sans" 
)

◆ draw_text() [2/2]

void draw_text ( cairo_t cr,
Geom::Point  pos,
const std::string &  txt,
bool  bottom = false,
const std::string &  fontdesc = "Sans" 
)

Definition at line 135 of file toy-framework-2.cpp.

References draw_text().

◆ draw_toggles()

void draw_toggles ( cairo_t cr,
std::vector< Toggle > &  ts 
)

Definition at line 739 of file toy-framework-2.cpp.

◆ get_clipboard_text()

void get_clipboard_text ( std::function< void(char const *)> &&  on_completion)

Definition at line 303 of file toy-framework-2.cpp.

References data, and the_canvas.

◆ init()

◆ operator<<()

std::ostream & operator<< ( std::ostream &  o,
Timer::Time const &  t 
)
inline

Definition at line 428 of file toy-framework-2.h.

References Timer::Time::value.

◆ read_point()

Geom::Point read_point ( FILE *  f)

Definition at line 296 of file toy-framework-2.cpp.

Referenced by PointHandle::load(), and PointSetHandle::load().

◆ redraw()

void redraw ( )

◆ take_screenshot()

void take_screenshot ( const char *  file)

◆ toggle_events()

void toggle_events ( std::vector< Toggle > &  ts,
Geom::Point const &  pos,
unsigned  button 
)

Definition at line 732 of file toy-framework-2.cpp.

◆ uniform()

Variable Documentation

◆ NS_PER_NS

const long long NS_PER_NS = 1

Definition at line 367 of file toy-framework-2.h.

Referenced by Timer::nsec().

◆ NS_PER_SECOND

const long long NS_PER_SECOND = 1000000000LL

Definition at line 366 of file toy-framework-2.h.

Referenced by Timer::nsec().