forked from zao/foo_wave_seekbar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SeekbarCui.h
119 lines (99 loc) · 2.43 KB
/
SeekbarCui.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// Copyright Lars Viklund 2008 - 2011.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include "SeekbarWindow.h"
namespace uie
{
template <typename W, typename T = window>
struct container_atl_window : W, T
{
window_host_ptr host;
HWND create_or_transfer_window(HWND parent, const window_host_ptr& new_host, const ui_helpers::window_position_t& position)
{
if ((HWND)*this)
{
ShowWindow(SW_HIDE);
SetParent(parent);
host->relinquish_ownership(*this);
host = new_host;
SetWindowPos(0, position.x, position.y, position.cx, position.cy, SWP_NOZORDER);
}
else
{
host = new_host;
CRect r;
position.convert_to_rect(r);
Create(parent, r, 0, WS_CHILD, settings.has_border ? WS_EX_STATICEDGE: 0);
}
return *this;
}
virtual void destroy_window()
{
::DestroyWindow(*this);
host.release();
}
virtual bool is_available(const window_host_ptr& p) const
{
return true;
}
const window_host_ptr& get_host() const
{
return host;
}
virtual HWND get_wnd() const
{
return *this;
}
};
}
namespace wave
{
struct seekbar_uie_base : uie::container_atl_window<seekbar_window>
{
seekbar_uie_base();
~seekbar_uie_base();
virtual void set_config(stream_reader * p_reader, t_size p_size, abort_callback & p_abort);
virtual void get_config(stream_writer * p_writer, abort_callback & p_abort) const;
virtual void get_name(pfc::string_base& out) const;
struct color_callback : cui::colours::common_callback
{
color_callback(seekbar_uie_base& parent);
void on_colour_changed(t_size) const;
void on_bool_changed(t_size) const;
seekbar_uie_base& sb;
} color_cb;
};
extern const GUID s_panel_guid, s_toolbar_guid;
template <uie::window_type_t WindowType>
struct seekbar_uie_t : seekbar_uie_base
{
virtual void get_category(pfc::string_base& out) const
{
switch (WindowType)
{
case uie::type_toolbar:
out.set_string("Toolbars"); return;
case uie::type_panel:
default:
out.set_string("Panels"); return;
}
}
virtual const GUID& get_extension_guid() const
{
switch (WindowType)
{
case uie::type_toolbar:
return s_toolbar_guid;
case uie::type_panel:
default:
return s_panel_guid;
}
}
virtual unsigned get_type() const
{
return WindowType;
}
};
}