MCPcopy Create free account
hub / github.com/TankOs/SFGUI / CreateNotebookDrawable

Method CreateNotebookDrawable

src/SFGUI/Engines/BREW/Notebook.cpp:9–580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace eng {
8
9std::unique_ptr<RenderQueue> BREW::CreateNotebookDrawable( std::shared_ptr<const Notebook> notebook ) const {
10 auto border_color = GetProperty<sf::Color>( "BorderColor", notebook );
11 auto border_color_light( border_color );
12 auto border_color_dark( border_color );
13 auto border_color_shift = GetProperty<int>( "BorderColorShift", notebook );
14 auto background_color = GetProperty<sf::Color>( "BackgroundColor", notebook );
15 auto background_color_dark = GetProperty<sf::Color>( "BackgroundColorDark", notebook );
16 auto background_color_prelight = GetProperty<sf::Color>( "BackgroundColorPrelight", notebook );
17 auto padding = GetProperty<float>( "Padding", notebook );
18 auto border_width = GetProperty<float>( "BorderWidth", notebook );
19 auto scroll_button_size = GetProperty<float>( "ScrollButtonSize", notebook );
20 auto arrow_color = GetProperty<sf::Color>( "Color", notebook );
21 auto scroll_button_prelight = GetProperty<sf::Color>( "ScrollButtonPrelightColor", notebook );
22
23 ShiftBorderColors( border_color_light, border_color_dark, border_color_shift );
24
25 std::unique_ptr<RenderQueue> queue( new RenderQueue );
26
27 auto page_count = notebook->GetPageCount();
28
29 if( !page_count ) {
30 return queue;
31 }
32
33 auto current_page = notebook->GetCurrentPage();
34 auto prelight_tab = notebook->GetPrelightTab();
35
36 // Get size in the dimension all tabs have uniform size.
37 sf::Vector2f tab_size( notebook->GetNthTabLabel( 0 )->GetAllocation().size.x, notebook->GetNthTabLabel( 0 )->GetAllocation().size.y );
38
39 // Get size in the dimension all children have uniform size.
40 sf::Vector2f child_size( notebook->GetNthPage( 0 )->GetAllocation().size.x, notebook->GetNthPage( 0 )->GetAllocation().size.y );
41
42 if( notebook->GetTabPosition() == Notebook::TabPosition::TOP ) {
43 // Tabs are positioned at top.
44
45 // Pane.
46 queue->Add(
47 Renderer::Get().CreatePane(
48 sf::Vector2f( 0.f, tab_size.y + 2.f * ( border_width + padding ) ),
49 sf::Vector2f( child_size.x + 2.f * ( border_width + padding ), child_size.y + 2.f * ( border_width + padding ) ),
50 border_width,
51 background_color,
52 border_color,
53 border_color_shift
54 )
55 );
56
57 // First tab label left border
58 queue->Add(
59 Renderer::Get().CreateLine(
60 sf::Vector2f( notebook->GetScrollable() && notebook->GetFirstDisplayedTab() != 0 ? scroll_button_size : 0.f, 0.f ),
61 sf::Vector2f( notebook->GetScrollable() && notebook->GetFirstDisplayedTab() != 0 ? scroll_button_size : 0.f, tab_size.y + 3.f * border_width + 2.f * padding ),
62 border_color_light,
63 border_width
64 )
65 );
66

Callers 1

InvalidateImplMethod · 0.80

Calls 15

GetPageCountMethod · 0.80
GetCurrentPageMethod · 0.80
GetPrelightTabMethod · 0.80
GetNthTabLabelMethod · 0.80
GetNthPageMethod · 0.80
GetTabPositionMethod · 0.80
CreatePaneMethod · 0.80
CreateLineMethod · 0.80
GetScrollableMethod · 0.80
GetFirstDisplayedTabMethod · 0.80
GetDisplayedTabCountMethod · 0.80
CreateRectMethod · 0.80

Tested by

no test coverage detected