tesseract  5.0.0-alpha-619-ge9db
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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }
ScrollView
Definition: scrollview.h:97
SVEventType
SVEventType
Definition: scrollview.h:44
SVET_CLICK
Definition: scrollview.h:47
SVET_INPUT
Definition: scrollview.h:49
SVET_ANY
Definition: scrollview.h:55
ScrollView::AwaitEvent
SVEvent * AwaitEvent(SVEventType type)
Definition: scrollview.cpp:443
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:34