Ardour
9.0-pre0-582-g084a23a80d
surfaces/push2/menu.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
*/
18
19
#ifndef __ardour_push2_menu_h__
20
#define __ardour_push2_menu_h__
21
22
#include <vector>
23
24
namespace
Cairo {
25
class
Context;
26
}
27
28
#include <pangomm/fontdescription.h>
29
30
#include "
pbd/signals.h
"
31
32
#include "
canvas/container.h
"
33
34
namespace
ArdourCanvas
{
35
class
Text;
36
class
Rectangle;
37
class
Rect;
38
}
39
40
namespace
ArdourSurface
{
41
42
class
Push2Menu
:
public
ArdourCanvas::Container
43
{
44
public
:
45
Push2Menu
(
ArdourCanvas::Item
*
parent
, std::vector<std::string>);
46
47
void
render
(
ArdourCanvas::Rect
const
& area, Cairo::RefPtr<Cairo::Context> context)
const
;
48
49
void
set_wrap
(
bool
);
50
void
set_active
(uint32_t index);
51
52
uint32_t
active
()
const
{
return
_active
; }
53
uint32_t
items
()
const
{
return
_displays
.size(); }
54
55
uint32_t
rows
()
const
{
return
_nrows
; }
56
uint32_t
cols
()
const
{
return
_ncols
; }
57
58
void
set_layout
(
int
cols
,
int
rows
);
59
void
set_font_description
(Pango::FontDescription);
60
void
set_text_color
(
Gtkmm2ext::Color
);
61
void
set_active_color
(
Gtkmm2ext::Color
);
62
63
bool
can_scroll_left
()
const
{
return
_first
>=
_nrows
; }
64
bool
can_scroll_right
()
const
{
return
_last
<
_displays
.size() - 1; }
65
66
enum
Direction
{
DirectionUp
,
DirectionDown
,
DirectionLeft
,
DirectionRight
};
67
void
scroll
(
Direction
,
bool
page =
false
);
68
69
PBD::Signal
<void()>
ActiveChanged
;
70
PBD::Signal
<void()>
Rearranged
;
71
72
private
:
73
std::vector<ArdourCanvas::Text*>
_displays
;
74
ArdourCanvas::Rectangle
*
_active_bg
;
75
76
void
rearrange
(uint32_t initial_display);
77
78
double
_baseline
;
79
int
_row_start
;
80
int
_col_start
;
81
uint32_t
_ncols
;
82
uint32_t
_nrows
;
83
bool
_wrap
;
84
uint32_t
_first
;
85
uint32_t
_last
;
86
uint32_t
_active
;
87
88
Gtkmm2ext::Color
_text_color
;
89
Gtkmm2ext::Color
_active_color
;
90
Gtkmm2ext::Color
_contrast_color
;
91
Pango::FontDescription
_font_description
;
92
93
inline
int
active_row
()
const
{
return
_active
%
_nrows
; }
94
inline
int
active_col
()
const
{
return
(
_active
/
_nrows
); }
95
inline
int
active_top
()
const
{
return
active_col
() *
_nrows
; }
96
};
97
98
}
// namespace
99
100
#endif
/* __ardour_push2_menu_h__ */
container.h
ArdourCanvas::Container
Definition:
canvas/canvas/container.h:40
ArdourCanvas::Item
Definition:
canvas/canvas/item.h:57
ArdourCanvas::Item::parent
Item * parent() const
Definition:
canvas/canvas/item.h:114
ArdourCanvas::Rectangle
Definition:
canvas/canvas/rectangle.h:31
ArdourSurface::Push2Menu
Definition:
surfaces/push2/menu.h:43
ArdourSurface::Push2Menu::ActiveChanged
PBD::Signal< void()> ActiveChanged
Definition:
surfaces/push2/menu.h:69
ArdourSurface::Push2Menu::set_layout
void set_layout(int cols, int rows)
ArdourSurface::Push2Menu::can_scroll_right
bool can_scroll_right() const
Definition:
surfaces/push2/menu.h:64
ArdourSurface::Push2Menu::_font_description
Pango::FontDescription _font_description
Definition:
surfaces/push2/menu.h:91
ArdourSurface::Push2Menu::render
void render(ArdourCanvas::Rect const &area, Cairo::RefPtr< Cairo::Context > context) const
ArdourSurface::Push2Menu::set_text_color
void set_text_color(Gtkmm2ext::Color)
ArdourSurface::Push2Menu::rows
uint32_t rows() const
Definition:
surfaces/push2/menu.h:55
ArdourSurface::Push2Menu::_wrap
bool _wrap
Definition:
surfaces/push2/menu.h:83
ArdourSurface::Push2Menu::active_col
int active_col() const
Definition:
surfaces/push2/menu.h:94
ArdourSurface::Push2Menu::_active
uint32_t _active
Definition:
surfaces/push2/menu.h:86
ArdourSurface::Push2Menu::active_top
int active_top() const
Definition:
surfaces/push2/menu.h:95
ArdourSurface::Push2Menu::cols
uint32_t cols() const
Definition:
surfaces/push2/menu.h:56
ArdourSurface::Push2Menu::_displays
std::vector< ArdourCanvas::Text * > _displays
Definition:
surfaces/push2/menu.h:73
ArdourSurface::Push2Menu::_first
uint32_t _first
Definition:
surfaces/push2/menu.h:84
ArdourSurface::Push2Menu::_last
uint32_t _last
Definition:
surfaces/push2/menu.h:85
ArdourSurface::Push2Menu::set_active
void set_active(uint32_t index)
ArdourSurface::Push2Menu::_contrast_color
Gtkmm2ext::Color _contrast_color
Definition:
surfaces/push2/menu.h:90
ArdourSurface::Push2Menu::can_scroll_left
bool can_scroll_left() const
Definition:
surfaces/push2/menu.h:63
ArdourSurface::Push2Menu::Direction
Direction
Definition:
surfaces/push2/menu.h:66
ArdourSurface::Push2Menu::DirectionLeft
@ DirectionLeft
Definition:
surfaces/push2/menu.h:66
ArdourSurface::Push2Menu::DirectionDown
@ DirectionDown
Definition:
surfaces/push2/menu.h:66
ArdourSurface::Push2Menu::DirectionUp
@ DirectionUp
Definition:
surfaces/push2/menu.h:66
ArdourSurface::Push2Menu::DirectionRight
@ DirectionRight
Definition:
surfaces/push2/menu.h:66
ArdourSurface::Push2Menu::Push2Menu
Push2Menu(ArdourCanvas::Item *parent, std::vector< std::string >)
ArdourSurface::Push2Menu::active_row
int active_row() const
Definition:
surfaces/push2/menu.h:93
ArdourSurface::Push2Menu::_nrows
uint32_t _nrows
Definition:
surfaces/push2/menu.h:82
ArdourSurface::Push2Menu::_col_start
int _col_start
Definition:
surfaces/push2/menu.h:80
ArdourSurface::Push2Menu::_active_bg
ArdourCanvas::Rectangle * _active_bg
Definition:
surfaces/push2/menu.h:74
ArdourSurface::Push2Menu::scroll
void scroll(Direction, bool page=false)
ArdourSurface::Push2Menu::_ncols
uint32_t _ncols
Definition:
surfaces/push2/menu.h:81
ArdourSurface::Push2Menu::active
uint32_t active() const
Definition:
surfaces/push2/menu.h:52
ArdourSurface::Push2Menu::set_active_color
void set_active_color(Gtkmm2ext::Color)
ArdourSurface::Push2Menu::set_font_description
void set_font_description(Pango::FontDescription)
ArdourSurface::Push2Menu::_active_color
Gtkmm2ext::Color _active_color
Definition:
surfaces/push2/menu.h:89
ArdourSurface::Push2Menu::items
uint32_t items() const
Definition:
surfaces/push2/menu.h:53
ArdourSurface::Push2Menu::set_wrap
void set_wrap(bool)
ArdourSurface::Push2Menu::_text_color
Gtkmm2ext::Color _text_color
Definition:
surfaces/push2/menu.h:88
ArdourSurface::Push2Menu::Rearranged
PBD::Signal< void()> Rearranged
Definition:
surfaces/push2/menu.h:70
ArdourSurface::Push2Menu::_row_start
int _row_start
Definition:
surfaces/push2/menu.h:79
ArdourSurface::Push2Menu::rearrange
void rearrange(uint32_t initial_display)
ArdourSurface::Push2Menu::_baseline
double _baseline
Definition:
surfaces/push2/menu.h:78
PBD::Signal
Definition:
signals.h:169
ArdourCanvas
Definition:
audio_clip_editor.h:56
ArdourSurface
Definition:
cc121.h:71
Gtkmm2ext::Color
uint32_t Color
Definition:
colors.h:33
signals.h
ArdourCanvas::Rect
Definition:
canvas/canvas/types.h:112
libs
surfaces
push2
menu.h
Generated on Wed Dec 25 2024 05:44:34 for Ardour by
1.9.1