tesseract
5.2.0
Loading...
Searching...
No Matches
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 <string>
33
34
namespace
tesseract
{
35
36
class
ScrollView;
37
38
class
SVMenuNode
{
39
public
:
40
// Creating the (empty) root menu node.
41
SVMenuNode
();
42
43
// Destructor for every node.
44
~SVMenuNode
();
45
46
// Create a new sub menu node with just a caption. This is used to create
47
// nodes which act as parent nodes to other nodes (e.g. submenus).
48
SVMenuNode
*
AddChild
(
const
char
*txt);
49
50
// Create a "normal" menu node which is associated with a command event.
51
void
AddChild
(
const
char
*txt,
int
command_event);
52
53
// Create a flag menu node.
54
void
AddChild
(
const
char
*txt,
int
command_event,
int
tv);
55
56
// Create a menu node with an associated value (which might be changed
57
// through the gui).
58
void
AddChild
(
const
char
*txt,
int
command_event,
const
char
*val);
59
60
// Create a menu node with an associated value and description_.
61
void
AddChild
(
const
char
*txt,
int
command_event,
const
char
*val,
const
char
*desc);
62
63
// Build a menu structure for the server and send the necessary messages.
64
// Should be called on the root node. If menu_bar is true, a menu_bar menu
65
// is built (e.g. on top of the window), if it is false a popup menu is
66
// built which gets shown by right clicking on the window.
67
void
BuildMenu
(
ScrollView
*sv,
bool
menu_bar =
true
);
68
69
private
:
70
// Constructor holding the actual node data.
71
SVMenuNode
(
int
command_event,
const
char
*txt,
int
tv,
bool
check_box_entry,
const
char
*val =
""
,
72
const
char
*desc =
""
);
73
74
// Adds a new menu node to the current node.
75
void
AddChild
(
SVMenuNode
*svmn);
76
77
// The parent node of this node.
78
SVMenuNode
*parent_;
79
// The first child of this node.
80
SVMenuNode
*child_;
81
// The next "sibling" of this node (e.g. same parent).
82
SVMenuNode
*next_;
83
// Whether this menu node actually is a flag.
84
bool
is_check_box_entry_;
85
// The value of the flag (if this menu node is a flag).
86
bool
toggle_value_;
87
88
// The command event associated with a specific menu node. Should be unique.
89
int
cmd_event_;
90
// The caption associated with a specific menu node.
91
std::string text_;
92
// The value of the menu node. (optional)
93
std::string value_;
94
// A description_ of the value. (optional)
95
std::string description_;
96
};
97
98
}
// namespace tesseract
99
100
#endif
// !GRAPHICS_DISABLED
101
102
#endif
// TESSERACT_VIEWER_SVMNODE_H_
tesseract
Definition:
baseapi.h:39
tesseract::ScrollView
Definition:
scrollview.h:108
tesseract::SVMenuNode
Definition:
svmnode.h:38
tesseract::SVMenuNode::AddChild
SVMenuNode * AddChild(const char *txt)
Definition:
svmnode.cpp:59
tesseract::SVMenuNode::BuildMenu
void BuildMenu(ScrollView *sv, bool menu_bar=true)
Definition:
svmnode.cpp:120
tesseract::SVMenuNode::SVMenuNode
SVMenuNode()
Definition:
svmnode.cpp:46
tesseract::SVMenuNode::~SVMenuNode
~SVMenuNode()
src
viewer
svmnode.h
Generated on Tue Mar 21 2023 18:51:21 for tesseract by
1.9.6