-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainFormBase.cpp
More file actions
86 lines (64 loc) · 1.78 KB
/
Copy pathMainFormBase.cpp
File metadata and controls
86 lines (64 loc) · 1.78 KB
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
#include "MainFormBase.h"
#include "TabPageBase.h"
MainFormBase::MainFormBase( std::string caption )
:
MainFormBase( caption,CENTER_FORM( WNDWIDTH,WNDHEIGHT ) )
{
}
MainFormBase::MainFormBase( std::string caption,const rectangle& rec,const appearance& app,const window& wnd )
:
form( wnd,rec,app )
{
this->caption( ( caption ) );
}
MainFormBase::~MainFormBase()
{
}
void MainFormBase::MainSetup( const char* placeDiv,bool isModal,int startTabPageIndex,const char* tabDivName,const char* tabBarDivName )
{
m_tabBarDivName = tabBarDivName;
m_place.bind( *this );
m_place.div( placeDiv );
InitMainForm();
InitTabBar( startTabPageIndex,tabDivName );
UpdateStrings();
m_place.collocate();
if( isModal )
API::modal_window( *this );
}
void MainFormBase::UpdateStrings()
{
UpdateStringsWidgets();
UpdateStringsModalForms();
for( auto & i : m_vTabPages )
{
std::dynamic_pointer_cast<TabPageBase>( i )->UpdateStrings();
}
}
void MainFormBase::InitTabBar( int startTabPageIndex,const char* tabDivName )
{
m_tabBar.create( *this );
m_place.field( tabDivName ) << m_tabBar;
PreAttachTabBar();
std::size_t index = 0;
for( auto & i : m_vTabPages )
{
m_tabBar.attach( index++,*i );
m_place.field( m_tabBarDivName ).fasten( *i ); //Fasten the tab pages
}
PostAttachTabBar();
m_tabBar.activated( startTabPageIndex );
}
void MainFormBase::ChangeTabPage( int tabBarIndex,int tabPageIndex,bool dropOther,bool setFocus )
{
m_tabBar.attach( tabBarIndex,*m_vTabPages[ tabPageIndex ],dropOther );
m_vTabPages[ m_vTabPageDistribution[ tabBarIndex ] ]->hide();
if( setFocus )
m_tabBar.activated( tabBarIndex );
m_vTabPageDistribution[ tabBarIndex ] = tabPageIndex;
m_place.collocate();
}
void MainFormBase::SwitchToTabPage( int tabBarIndex )
{
m_tabBar.activated( tabBarIndex );
}