tesseract  5.0.0-alpha-619-ge9db
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 35 of file svmnode.h.

Constructor & Destructor Documentation

◆ SVMenuNode()

SVMenuNode::SVMenuNode ( )

Definition at line 44 of file svmnode.cpp.

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

◆ ~SVMenuNode()

SVMenuNode::~SVMenuNode ( )

Definition at line 53 of file svmnode.cpp.

53  {
54 }

Member Function Documentation

◆ AddChild() [1/5]

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

Definition at line 58 of file svmnode.cpp.

58  {
59  auto* s = new SVMenuNode(-1, txt, false, false, nullptr, nullptr);
60  this->AddChild(s);
61  return s;
62 }

◆ AddChild() [2/5]

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

Definition at line 65 of file svmnode.cpp.

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

◆ AddChild() [3/5]

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

Definition at line 71 of file svmnode.cpp.

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

◆ AddChild() [4/5]

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

Definition at line 77 of file svmnode.cpp.

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

◆ AddChild() [5/5]

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

Definition at line 83 of file svmnode.cpp.

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

◆ BuildMenu()

void 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_,
124  toggle_value_);
125  } else {
126  sv->MenuItem(parent_->text_.c_str(), text_.c_str(), cmd_event_); }
127  } else if ((parent_ != nullptr) && (!menu_bar)) {
128  if (description_.length() > 0) {
129  sv->PopupItem(parent_->text_.c_str(), text_.c_str(), cmd_event_,
130  value_.c_str(), 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); delete child_;
137  }
138  if (next_ != nullptr) {
139  next_->BuildMenu(sv, menu_bar); delete next_;
140  }
141 }

The documentation for this class was generated from the following files:
SVMenuNode::SVMenuNode
SVMenuNode()
Definition: svmnode.cpp:44
SVMenuNode::AddChild
SVMenuNode * AddChild(const char *txt)
Definition: svmnode.cpp:58
ScrollView::MenuItem
void MenuItem(const char *parent, const char *name)
Definition: scrollview.cpp:679
STRING::c_str
const char * c_str() const
Definition: strngs.cpp:192
SVMenuNode::BuildMenu
void BuildMenu(ScrollView *sv, bool menu_bar=true)
Definition: svmnode.cpp:120
STRING::length
int32_t length() const
Definition: strngs.cpp:187
ScrollView::PopupItem
void PopupItem(const char *parent, const char *name)
Definition: scrollview.cpp:685