tesseract  5.0.0
tesseract::SVMenuNode Class Reference

#include <svmnode.h>

Public Member Functions

 SVMenuNode ()
 
 ~SVMenuNode ()
 
SVMenuNodeAddChild (const char *txt)
 
void AddChild (const char *txt, int command_event)
 
void AddChild (const char *txt, int command_event, int tv)
 
void AddChild (const char *txt, int command_event, const char *val)
 
void AddChild (const char *txt, int command_event, const char *val, const char *desc)
 
void BuildMenu (ScrollView *sv, bool menu_bar=true)
 

Detailed Description

Definition at line 38 of file svmnode.h.

Constructor & Destructor Documentation

◆ SVMenuNode()

tesseract::SVMenuNode::SVMenuNode ( )

Definition at line 46 of file svmnode.cpp.

46  {
47  cmd_event_ = -1;
48  child_ = nullptr;
49  next_ = nullptr;
50  parent_ = nullptr;
51  toggle_value_ = false;
52  is_check_box_entry_ = false;
53 }

◆ ~SVMenuNode()

tesseract::SVMenuNode::~SVMenuNode ( )
default

Member Function Documentation

◆ AddChild() [1/5]

SVMenuNode * tesseract::SVMenuNode::AddChild ( const char *  txt)

Definition at line 59 of file svmnode.cpp.

59  {
60  auto *s = new SVMenuNode(-1, txt, false, false);
61  this->AddChild(s);
62  return s;
63 }
SVMenuNode * AddChild(const char *txt)
Definition: svmnode.cpp:59

◆ AddChild() [2/5]

void tesseract::SVMenuNode::AddChild ( const char *  txt,
int  command_event 
)

Definition at line 66 of file svmnode.cpp.

66  {
67  this->AddChild(new SVMenuNode(command_event, txt, false, false));
68 }

◆ AddChild() [3/5]

void tesseract::SVMenuNode::AddChild ( const char *  txt,
int  command_event,
const char *  val 
)

Definition at line 72 of file svmnode.cpp.

72  {
73  this->AddChild(new SVMenuNode(command_event, txt, false, false, val));
74 }

◆ AddChild() [4/5]

void tesseract::SVMenuNode::AddChild ( const char *  txt,
int  command_event,
const char *  val,
const char *  desc 
)

Definition at line 77 of file svmnode.cpp.

77  {
78  this->AddChild(new SVMenuNode(command_event, txt, false, false, val, desc));
79 }

◆ AddChild() [5/5]

void tesseract::SVMenuNode::AddChild ( const char *  txt,
int  command_event,
int  tv 
)

Definition at line 82 of file svmnode.cpp.

82  {
83  this->AddChild(new SVMenuNode(command_event, txt, tv, true));
84 }

◆ BuildMenu()

void tesseract::SVMenuNode::BuildMenu ( ScrollView sv,
bool  menu_bar = true 
)

Definition at line 120 of file svmnode.cpp.

120  {
121  if ((parent_ != nullptr) && (menu_bar)) {
122  if (is_check_box_entry_) {
123  sv->MenuItem(parent_->text_.c_str(), text_.c_str(), cmd_event_, toggle_value_);
124  } else {
125  sv->MenuItem(parent_->text_.c_str(), text_.c_str(), cmd_event_);
126  }
127  } else if ((parent_ != nullptr) && (!menu_bar)) {
128  if (description_.length() > 0) {
129  sv->PopupItem(parent_->text_.c_str(), text_.c_str(), cmd_event_, value_.c_str(),
130  description_.c_str());
131  } else {
132  sv->PopupItem(parent_->text_.c_str(), text_.c_str());
133  }
134  }
135  if (child_ != nullptr) {
136  child_->BuildMenu(sv, menu_bar);
137  delete child_;
138  }
139  if (next_ != nullptr) {
140  next_->BuildMenu(sv, menu_bar);
141  delete next_;
142  }
143 }
void BuildMenu(ScrollView *sv, bool menu_bar=true)
Definition: svmnode.cpp:120

The documentation for this class was generated from the following files: