tesseract 4.1.1
Loading...
Searching...
No Matches
callcpp.cpp File Reference
#include "callcpp.h"
#include <cstdarg>
#include <cstdio>
#include <memory>
#include "scrollview.h"
#include "tprintf.h"

Go to the source code of this file.

Functions

void cprintf (const char *format,...)
 
ScrollViewc_create_window (const char *name, int16_t xpos, int16_t ypos, int16_t xsize, int16_t ysize, double xmin, double xmax, double ymin, double ymax)
 
void c_line_color_index (void *win, C_COL index)
 
void c_move (void *win, double x, double y)
 
void c_draw (void *win, double x, double y)
 
void c_make_current (void *win)
 
void c_clear_window (void *win)
 
char window_wait (ScrollView *win)
 

Function Documentation

◆ c_clear_window()

void c_clear_window ( void *  win)

Definition at line 96 of file callcpp.cpp.

97 {
98 auto* window = static_cast<ScrollView*>(win);
99 window->Clear();
100}
void Clear()
Definition: scrollview.cpp:589

◆ c_create_window()

ScrollView * c_create_window ( const char *  name,
int16_t  xpos,
int16_t  ypos,
int16_t  xsize,
int16_t  ysize,
double  xmin,
double  xmax,
double  ymin,
double  ymax 
)

Definition at line 47 of file callcpp.cpp.

57 {
58 return new ScrollView(name, xpos, ypos, xsize, ysize, xmax - xmin, ymax - ymin, true);
59}

◆ c_draw()

void c_draw ( void *  win,
double  x,
double  y 
)

Definition at line 80 of file callcpp.cpp.

83 {
84 auto* window = static_cast<ScrollView*>(win);
85 window->DrawTo(static_cast<int>(x), static_cast<int>(y));
86}
void DrawTo(int x, int y)
Definition: scrollview.cpp:525

◆ c_line_color_index()

void c_line_color_index ( void *  win,
C_COL  index 
)

Definition at line 62 of file callcpp.cpp.

64 {
65 // The colors are the same as the SV ones except that SV has COLOR:NONE --> offset of 1
66 auto* window = static_cast<ScrollView*>(win);
67 window->Pen(static_cast<ScrollView::Color>(index + 1));
68}
void Pen(Color color)
Definition: scrollview.cpp:719

◆ c_make_current()

void c_make_current ( void *  win)

Definition at line 89 of file callcpp.cpp.

90 {
91 auto* window = static_cast<ScrollView*>(win);
92 window->Update();
93}
static void Update()
Definition: scrollview.cpp:709

◆ c_move()

void c_move ( void *  win,
double  x,
double  y 
)

Definition at line 71 of file callcpp.cpp.

74 {
75 auto* window = static_cast<ScrollView*>(win);
76 window->SetCursor(static_cast<int>(x), static_cast<int>(y));
77}
void SetCursor(int x, int y)
Definition: scrollview.cpp:519

◆ cprintf()

void cprintf ( const char *  format,
  ... 
)

Definition at line 32 of file callcpp.cpp.

34 {
35 va_list args; //variable args
36 char msg[1000];
37
38 va_start(args, format); //variable list
39 vsprintf(msg, format, args); //Format into msg
40 va_end(args);
41
42 tprintf("%s", msg);
43}
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:35

◆ window_wait()

char window_wait ( ScrollView win)

Definition at line 103 of file callcpp.cpp.

103 {
104 // Wait till an input or click event (all others are thrown away)
105 char ret = '\0';
106 SVEventType ev_type = SVET_ANY;
107 do {
108 std::unique_ptr<SVEvent> ev(win->AwaitEvent(SVET_ANY));
109 ev_type = ev->type;
110 if (ev_type == SVET_INPUT)
111 ret = ev->parameter[0];
112 } while (ev_type != SVET_INPUT && ev_type != SVET_CLICK);
113 return ret;
114}
SVEventType
Definition: scrollview.h:45
@ SVET_CLICK
Definition: scrollview.h:48
@ SVET_ANY
Definition: scrollview.h:56
@ SVET_INPUT
Definition: scrollview.h:50
SVEvent * AwaitEvent(SVEventType type)
Definition: scrollview.cpp:443