本文整理汇总了C++中ToolBar::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolBar::GetSize方法的具体用法?C++ ToolBar::GetSize怎么用?C++ ToolBar::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolBar
的用法示例。
在下文中一共展示了ToolBar::GetSize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowWindowedToolBar
/// This will make the floating ToolBarFrame appear at the specified location
void ToolBarStub::ShowWindowedToolBar(wxPoint * where /* = NULL */ )
{
if (!mWindowedStatus) {
if (!mToolBarFrame) {
//Create a frame with a toolbar of type tbt inside it
if (mType == MeterToolBarID)
mToolBarFrame = new ToolBarFullFrame(mFrameParent, mType);
else
mToolBarFrame = new ToolBarMiniFrame(mFrameParent, mType);
//Get the newly-created toolbar to get some info from it.
ToolBar * tempTB = mToolBarFrame->GetToolBar();
mTitle = tempTB->GetTitle();
mSize = tempTB->GetSize();
}
//Move the frame to the mouse position
if (where) {
mToolBarFrame->DoMove(*where);
}
//Show the new window
mToolBarFrame->DoShow();
}
mWindowedStatus = true;
}
示例2: WriteConfig
//
// Save the toolbar states
//
void ToolManager::WriteConfig()
{
if( !gPrefs )
{
return;
}
wxString oldpath = gPrefs->GetPath();
int ndx;
// Change to the bar root
gPrefs->SetPath( wxT("/GUI/ToolBars") );
// Save state of each bar
for( ndx = 0; ndx < ToolBarCount; ndx++ )
{
ToolBar *bar = mBars[ ndx ];
// Change to the bar subkey
gPrefs->SetPath( bar->GetSection() );
// Search both docks for toolbar order
int to = mTopDock->GetOrder( bar );
int bo = mBotDock->GetOrder( bar );
// Save
gPrefs->Write( wxT("Dock"), to ? TopDockID : bo ? BotDockID : NoDockID );
gPrefs->Write( wxT("Order"), to + bo );
gPrefs->Write( wxT("Show"), IsVisible( ndx ) );
wxPoint pos( -1, -1 );
wxSize sz = bar->GetSize();
if( !bar->IsDocked() )
{
pos = bar->GetParent()->GetPosition();
sz = bar->GetParent()->GetSize();
}
gPrefs->Write( wxT("X"), pos.x );
gPrefs->Write( wxT("Y"), pos.y );
gPrefs->Write( wxT("W"), sz.x );
gPrefs->Write( wxT("H"), sz.y );
// Kill the bar
bar->Destroy();
// Change back to the bar root
gPrefs->SetPath( wxT("..") );
}
// Restore original config path
gPrefs->SetPath( oldpath );
gPrefs->Flush();
}
示例3: WriteConfig
//
// Save the toolbar states
//
void ToolManager::WriteConfig()
{
if( !gPrefs )
{
return;
}
wxString oldpath = gPrefs->GetPath();
int ndx;
// Change to the bar root
gPrefs->SetPath( wxT("/GUI/ToolBars") );
// Save state of each bar
for( ndx = 0; ndx < ToolBarCount; ndx++ )
{
ToolBar *bar = mBars[ ndx ].get();
// Change to the bar subkey
gPrefs->SetPath( bar->GetSection() );
// Search both docks for toolbar order
bool to = mTopDock->GetConfiguration().Contains( bar );
bool bo = mBotDock->GetConfiguration().Contains( bar );
// Save
gPrefs->Write( wxT("Dock"), (int) (to ? TopDockID : bo ? BotDockID : NoDockID ));
auto dock = to ? mTopDock : bo ? mBotDock : nullptr;
ToolBarConfiguration::Write
(dock ? &dock->GetConfiguration() : nullptr, bar);
wxPoint pos( -1, -1 );
wxSize sz = bar->GetSize();
if( !bar->IsDocked() && bar->IsPositioned() )
{
pos = bar->GetParent()->GetPosition();
sz = bar->GetParent()->GetSize();
}
gPrefs->Write( wxT("X"), pos.x );
gPrefs->Write( wxT("Y"), pos.y );
gPrefs->Write( wxT("W"), sz.x );
gPrefs->Write( wxT("H"), sz.y );
// Change back to the bar root
gPrefs->SetPath( wxT("..") );
}
// Restore original config path
gPrefs->SetPath( oldpath );
gPrefs->Flush();
}
示例4: ToolBarFrame
// ToolBarStub Constructer. Requires a ToolBarType.
// Whenever a ToolBarStub is around, there will be a floating
// ToolBarFrame. It may be hidden or unhidden.
ToolBarStub::ToolBarStub(wxWindow * Parent, enum ToolBarType tbt)
{
//Create a frame with a toolbar of type tbt inside it
mToolBarFrame = new ToolBarFrame(Parent, tbt);
//Get the newly-created toolbar to get some info from it.
ToolBar * tempTB = mToolBarFrame->GetToolBar();
mType = tbt;
mTitle = tempTB->GetTitle();
mSize = tempTB->GetSize();
mWindowedStatus = false;
mLoadedStatus = true;
}
示例5: ReadConfig
//
// Read the toolbar states
//
void ToolManager::ReadConfig()
{
wxString oldpath = gPrefs->GetPath();
wxArrayInt unordered[ DockCount ];
int order[ DockCount ][ ToolBarCount ];
bool show[ ToolBarCount ];
int width[ ToolBarCount ];
int height[ ToolBarCount ];
int x, y;
int dock, ord, ndx;
#if defined(__WXMAC__)
// Disable window animation
wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 );
#endif
// Invalidate all order entries
for( dock = 0; dock < DockCount; dock++ )
{
for( ord = 0; ord < ToolBarCount; ord++ )
{
order[ dock ][ ord ] = NoBarID;
}
}
// Change to the bar root
gPrefs->SetPath( wxT("/GUI/ToolBars") );
// Load and apply settings for each bar
for( ndx = 0; ndx < ToolBarCount; ndx++ )
{
ToolBar *bar = mBars[ ndx ];
// Change to the bar subkey
gPrefs->SetPath( bar->GetSection() );
// Read in all the settings
gPrefs->Read( wxT("Dock"), &dock, ndx == SelectionBarID ? BotDockID : TopDockID );
gPrefs->Read( wxT("Order"), &ord, NoBarID );
gPrefs->Read( wxT("Show"), &show[ ndx ], true );
gPrefs->Read( wxT("X"), &x, -1 );
gPrefs->Read( wxT("Y"), &y, -1 );
gPrefs->Read( wxT("W"), &width[ ndx ], -1 );
gPrefs->Read( wxT("H"), &height[ ndx ], -1 );
// Docked or floating?
if( dock )
{
// Default to top dock if the ID isn't valid
if( dock < NoDockID || dock > DockCount ) {
dock = TopDockID;
}
// Create the bar with the correct parent
if( dock == TopDockID )
{
bar->Create( mTopDock );
}
else
{
bar->Create( mBotDock );
}
#ifdef EXPERIMENTAL_SYNC_LOCK
// Set the width
if( width[ ndx ] >= bar->GetSize().x )
{
wxSize sz( width[ ndx ], bar->GetSize().y );
bar->SetSize( sz );
bar->Layout();
}
#else
// note that this section is here because if you had been using sync-lock and now you aren't,
// the space for the extra button is stored in audacity.cfg, and so you get an extra space
// in the EditToolbar.
// It is needed so that the meterToolbar size gets preserved.
// Longer-term we should find a better fix for this.
wxString thisBar = bar->GetSection();
if( thisBar != wxT("Edit"))
{
// Set the width
if( width[ ndx ] >= bar->GetSize().x )
{
wxSize sz( width[ ndx ], bar->GetSize().y );
bar->SetSize( sz );
bar->Layout();
}
}
#endif
// Is order within range and unoccupied?
if( ( ord >= 0 ) &&
( ord < ToolBarCount ) &&
( order[ dock - 1 ][ ord ] == NoBarID ) )
{
// Insert at ordered location
order[ dock - 1 ][ ord ] = ndx;
//.........这里部分代码省略.........
示例6: PositionBar
//
// Determine the location and bar before which a new bar would be placed
//
// 'rect' will be the rectangle for the dock marker.
int ToolDock::PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect )
{
struct
{
wxRect rect;
wxSize min;
} tinfo[ ToolBarCount + 1 ];
wxRect stack[ ToolBarCount + 1 ];
wxPoint cpos, lpos;
int ct, lt = 0;
int ndx, stkcnt = 0;
int tindx = -1;
int cnt = mDockedBars.GetCount();
int width, height;
// Get size of our parent since we haven't been sized yet
GetParent()->GetClientSize( &width, &height );
width -= toolbarGap;
height -= toolbarGap;
// Set initial stack entry to maximum size
stack[ 0 ].SetX( toolbarGap );
stack[ 0 ].SetY( toolbarGap );
// The stack width and height are the remaining width and height.
stack[ 0 ].SetWidth( width );
stack[ 0 ].SetHeight( height );
// Process all docked and visible toolbars
//
// Careful...slightly different from above in that we expect to
// process one more bar than is currently docked (<= in for)
for (ndx = 0, ct = 0; ndx <= cnt; ndx++, ct++)
{
// If last entry, then it is the
if (ndx == cnt)
{
// ...so check to see if the new bar has been placed yet
if (tindx == -1)
{
// Add the new bars' dimensions to the mix
tinfo[ct].rect = t->GetRect();
tinfo[ct].min = t->GetDockedSize();
tindx = ct;
}
}
else
{
// Cache toolbar pointer
ToolBar *b = (ToolBar *)mDockedBars[ndx];
// Remember current bars' dimensions
tinfo[ct].rect = b->GetRect();
tinfo[ct].min = b->GetSize();
// Maybe insert the new bar if it hasn't already been done
// and is in the right place.
if (tindx == -1)
{
wxRect r;
// Get bar rect and make gap part of it
r.SetPosition(b->GetParent()->ClientToScreen(b->GetPosition()));
r.SetSize(b->IsResizable() ? b->GetSize() : b->GetSize());
r.width += toolbarGap;
r.height += toolbarGap;
// Does the location fall within this bar?
if (r.Contains(pos) || pos.y <= r.y)
{
// Add the new bars' dimensions to the mix
tinfo[ct].rect = t->GetRect();
tinfo[ct].min = t->GetDockedSize();
tindx = ct;
ndx--;
}
}
}
// Get and cache the toolbar sizes
wxSize sz = tinfo[ct].min;
int tw = sz.GetWidth() + toolbarGap;
int th = sz.GetHeight() + toolbarGap;
// This loop reduces stkcnt until it gives a box
// that we fit in.
while (stkcnt > 0)
{
// Get out if it will fit
bool bTooWide = tw > stack[stkcnt].GetWidth();
// We'd like to be able to add a tall toolbar in at the start of a row,
// even if there isn't enough height for it.
// If so, we'd have to at least change how we calculate 'bTooHigh'.
bool bTooHigh = th > stack[stkcnt].GetHeight();
//bTooHigh &= stack[stkcnt].GetWidth() < (width - toolbarGap);
//bTooHigh = false;
//.........这里部分代码省略.........
示例7: LayoutToolBars
//
// Layout the toolbars
//
void ToolDock::LayoutToolBars()
{
wxRect stack[ ToolBarCount + 1 ];
wxPoint cpos, lpos;
ToolBar *lt = NULL;
int ndx, stkcnt = 0;
int width, height;
// Get size of our parent since we haven't been sized yet
GetParent()->GetClientSize( &width, &height );
width -= toolbarGap;
height -= toolbarGap;
// Get the number of docked toolbars and take a quick exit
// if we don't have any
int cnt = mDockedBars.GetCount();
if( cnt == 0 )
{
SetMinSize( wxSize( width, toolbarGap ) );
return;
}
// Set initial stack entry to maximum size
stack[ 0 ].SetX( toolbarGap );
stack[ 0 ].SetY( toolbarGap );
stack[ 0 ].SetWidth( width );
stack[ 0 ].SetHeight( height );
// Process all docked and visible toolbars
for( ndx = 0; ndx < cnt; ndx++ )
{
// Cache toolbar pointer
ToolBar *ct = (ToolBar *)mDockedBars[ ndx ];
// Get and cache the toolbar sizes
wxSize sz = ct->GetSize();
int tw = sz.GetWidth() + toolbarGap;
int th = sz.GetHeight() + toolbarGap;
// Will this one fit in remaining horizontal space?
if( ( tw > stack[ stkcnt ].GetWidth() ) ||
( th > stack[ stkcnt ].GetHeight() ) )
{
// Destack entries until one is found in which this bar
// will fit or until we run out of stacked entries
while( stkcnt > 0 )
{
stkcnt--;
// Get out if it will fit
if( ( tw <= stack[ stkcnt ].GetWidth() ) &&
( th <= stack[ stkcnt ].GetHeight() ) )
{
break;
}
}
}
// The current stack entry position is where the bar
// will be placed.
cpos = stack[ stkcnt ].GetPosition();
// We'll be using at least a portion of this stack entry, so
// adjust the location and size. It is possible that these
// will become zero if this entry and the toolbar have the
// same height. This is what we want as it will be destacked
// in the next iteration.
stack[ stkcnt ].SetY( stack[ stkcnt ].GetY() + th );
stack[ stkcnt ].SetHeight( stack[ stkcnt ].GetHeight() - th );
// Calc the next possible horizontal location.
int x = cpos.x + tw;
// Add a new stack entry
stkcnt++;
stack[ stkcnt ].SetX( x );
stack[ stkcnt ].SetY( cpos.y );
stack[ stkcnt ].SetWidth( width - x );
stack[ stkcnt ].SetHeight( th );
// Position the previous toolbar
if( ndx > 0 )
{
// Keep the tab order in order
ct->MoveAfterInTabOrder( lt );
// Place the last toolbar
lt->SetPosition( wxPoint( lpos.x, lpos.y ) );
}
// Place the final toolbar
if( ndx == cnt - 1 )
{
ct->SetPosition( wxPoint( cpos.x, cpos.y ) );
}
// Remember for next iteration
//.........这里部分代码省略.........
示例8: PositionBar
//
// Determine the location and bar before which a new bar would be placed
//
int ToolDock::PositionBar( ToolBar *t, wxPoint & pos, wxRect & rect )
{
struct
{
wxRect rect;
wxSize min;
} tinfo[ ToolBarCount + 1 ];
wxRect stack[ ToolBarCount + 1 ];
wxPoint cpos, lpos;
int ct, lt = 0;
int ndx, stkcnt = 0;
int tindx = -1;
int cnt = mDockedBars.GetCount();
int width, height;
// Get size of our parent since we haven't been sized yet
GetParent()->GetClientSize( &width, &height );
width -= toolbarGap;
height -= toolbarGap;
// Set initial stack entry to maximum size
stack[ 0 ].SetX( toolbarGap );
stack[ 0 ].SetY( toolbarGap );
stack[ 0 ].SetWidth( width );
stack[ 0 ].SetHeight( height );
// Process all docked and visible toolbars
//
// Careful...slightly different from above in that we expect to
// process one more bar than is currently docked (<= in for)
for( ndx = 0, ct = 0; ndx <= cnt; ndx++, ct++ )
{
// We're on the last entry...
if( ndx == cnt )
{
// ...so check to see if the new bar has been placed yet
if( tindx == -1 )
{
// Add the new bars' dimensions to the mix
tinfo[ ct ].rect = t->GetRect();
tinfo[ ct ].min = t->GetMinSize();
tindx = ct;
}
}
else
{
// Cache toolbar pointer
ToolBar *b = (ToolBar *) mDockedBars[ ndx ];
// Remember current bars' dimensions
tinfo[ ct ].rect = b->GetRect();
tinfo[ ct ].min = b->GetSize();
// Insert the new bar if it hasn't already been done
if( tindx == -1 )
{
wxRect r;
// Get bar rect and make gap part of it
r.SetPosition( b->GetParent()->ClientToScreen( b->GetPosition() ) );
r.SetSize( b->IsResizable() ? b->GetSize() : b->GetSize() );
r.width += toolbarGap;
r.height += toolbarGap;
// Does the location fall within this bar?
if( r.Contains( pos ) || pos.y <= r.y )
{
// Add the new bars' dimensions to the mix
tinfo[ ct ].rect = t->GetRect();
tinfo[ ct ].min = t->GetSize();
tindx = ct;
ndx--;
}
}
}
// Get and cache the toolbar sizes
wxSize sz = tinfo[ ct ].min;
int tw = sz.GetWidth() + toolbarGap;
int th = sz.GetHeight() + toolbarGap;
// Will this one fit in remaining horizontal space?
if( ( tw > stack[ stkcnt ].GetWidth() ) ||
( th > stack[ stkcnt ].GetHeight() ) )
{
// Destack entries until one is found in which this bar
// will fit or until we run out of stacked entries
while( stkcnt > 0 )
{
stkcnt--;
// Get out if it will fit
if( ( tw <= stack[ stkcnt ].GetWidth() ) &&
( th <= stack[ stkcnt ].GetHeight() ) )
{
break;
//.........这里部分代码省略.........
示例9: ReadConfig
//.........这里部分代码省略.........
gPrefs->Read( wxT("Y"), &y, -1 );
gPrefs->Read( wxT("W"), &width[ ndx ], -1 );
gPrefs->Read( wxT("H"), &height[ ndx ], -1 );
bar->SetVisible( show[ ndx ] );
// Docked or floating?
if( dock )
{
// Default to top dock if the ID isn't valid
if( dock < NoDockID || dock > DockCount ) {
dock = TopDockID;
}
// Create the bar with the correct parent
if( dock == TopDockID )
{
bar->Create( mTopDock );
}
else
{
bar->Create( mBotDock );
}
// Set the width and height
if( width[ ndx ] != -1 && height[ ndx ] != -1 )
{
wxSize sz( width[ ndx ], height[ ndx ] );
bar->SetSize( sz );
}
#ifdef EXPERIMENTAL_SYNC_LOCK
// Set the width
if( width[ ndx ] >= bar->GetSize().x )
{
wxSize sz( width[ ndx ], bar->GetSize().y );
bar->SetSize( sz );
bar->Layout();
}
#else
// note that this section is here because if you had been using sync-lock and now you aren't,
// the space for the extra button is stored in audacity.cfg, and so you get an extra space
// in the EditToolbar.
// It is needed so that the meterToolbar size gets preserved.
// Longer-term we should find a better fix for this.
wxString thisBar = bar->GetSection();
if( thisBar != wxT("Edit"))
{
// Set the width
if( width[ ndx ] >= bar->GetSize().x )
{
wxSize sz( width[ ndx ], bar->GetSize().y );
bar->SetSize( sz );
bar->Layout();
}
}
#endif
if (!ordered)
{
// These must go at the end
unordered[ dock - 1 ].Add( ndx );
}
}
else
{