tesseract
v5.3.3.20231005
svmnode.h
Go to the documentation of this file.
1
2
// File: svmnode.h
3
// description_: ScrollView Menu Node
4
// Author: Joern Wanke
5
//
6
// (C) Copyright 2007, Google Inc.
7
// Licensed under the Apache License, Version 2.0 (the "License");
8
// you may not use this file except in compliance with the License.
9
// You may obtain a copy of the License at
10
// http://www.apache.org/licenses/LICENSE-2.0
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
//
18
//
19
// A SVMenuNode is an entity which contains the mapping from a menu entry on
20
// the server side to the corresponding associated commands on the client.
21
// It is designed to be a tree structure with a root node, which can then be
22
// used to generate the appropriate messages to the server to display the
23
// menu structure there.
24
// A SVMenuNode can both be used in the context_ of popup menus as well as
25
// menu bars.
26
27
#ifndef TESSERACT_VIEWER_SVMNODE_H_
28
#define TESSERACT_VIEWER_SVMNODE_H_
29
30
#ifndef GRAPHICS_DISABLED
31
32
#include <
tesseract/export.h
>
33
34
#include <string>
35
36
namespace
tesseract
{
37
38
class
ScrollView;
39
40
class
TESS_API
SVMenuNode
{
41
public
:
42
// Creating the (empty) root menu node.
43
SVMenuNode
();
44
45
// Destructor for every node.
46
~SVMenuNode
();
47
48
// Create a new sub menu node with just a caption. This is used to create
49
// nodes which act as parent nodes to other nodes (e.g. submenus).
50
SVMenuNode
*AddChild(
const
char
*txt);
51
52
// Create a "normal" menu node which is associated with a command event.
53
void
AddChild(
const
char
*txt,
int
command_event);
54
55
// Create a flag menu node.
56
void
AddChild(
const
char
*txt,
int
command_event,
int
tv);
57
58
// Create a menu node with an associated value (which might be changed
59
// through the gui).
60
void
AddChild(
const
char
*txt,
int
command_event,
const
char
*val);
61
62
// Create a menu node with an associated value and description_.
63
void
AddChild(
const
char
*txt,
int
command_event,
const
char
*val,
const
char
*desc);
64
65
// Build a menu structure for the server and send the necessary messages.
66
// Should be called on the root node. If menu_bar is true, a menu_bar menu
67
// is built (e.g. on top of the window), if it is false a popup menu is
68
// built which gets shown by right clicking on the window.
69
void
BuildMenu(
ScrollView
*sv,
bool
menu_bar =
true
);
70
71
private
:
72
// Constructor holding the actual node data.
73
SVMenuNode
(
int
command_event,
const
char
*txt,
int
tv,
bool
check_box_entry,
const
char
*val =
""
,
74
const
char
*desc =
""
);
75
76
// Adds a new menu node to the current node.
77
void
AddChild(
SVMenuNode
*svmn);
78
79
// The parent node of this node.
80
SVMenuNode
*parent_;
81
// The first child of this node.
82
SVMenuNode
*child_;
83
// The next "sibling" of this node (e.g. same parent).
84
SVMenuNode
*next_;
85
// Whether this menu node actually is a flag.
86
bool
is_check_box_entry_;
87
// The value of the flag (if this menu node is a flag).
88
bool
toggle_value_;
89
90
// The command event associated with a specific menu node. Should be unique.
91
int
cmd_event_;
92
// The caption associated with a specific menu node.
93
std::string text_;
94
// The value of the menu node. (optional)
95
std::string value_;
96
// A description_ of the value. (optional)
97
std::string description_;
98
};
99
100
}
// namespace tesseract
101
102
#endif
// !GRAPHICS_DISABLED
103
104
#endif
// TESSERACT_VIEWER_SVMNODE_H_
tesseract
Definition:
baseapi.h:39
tesseract::ScrollView
Definition:
scrollview.h:109
tesseract::SVMenuNode
Definition:
svmnode.h:40
tesseract::SVMenuNode::~SVMenuNode
~SVMenuNode()
export.h
TESS_API
#define TESS_API
Definition:
export.h:32
src
viewer
svmnode.h
Generated on Thu Oct 5 2023 22:10:27 for tesseract by
1.9.4