本文整理汇总了C++中ToolBar::SetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolBar::SetSize方法的具体用法?C++ ToolBar::SetSize怎么用?C++ ToolBar::SetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolBar
的用法示例。
在下文中一共展示了ToolBar::SetSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reset
void ToolManager::Reset()
{
int ndx;
// Disconnect all docked bars
for( ndx = 0; ndx < ToolBarCount; ndx++ )
{
wxWindow *parent;
ToolDock *dock;
ToolBar *bar = mBars[ ndx ];
// Disconnect the bar
if( bar->IsDocked() )
{
bar->GetDock()->Undock( bar );
parent = NULL;
}
else
{
parent = bar->GetParent();
}
if( ndx == SelectionBarID )
{
dock = mBotDock;
wxCommandEvent e;
bar->GetEventHandler()->ProcessEvent(e);
}
else
{
dock = mTopDock;
bar->ReCreateButtons();
}
bar->EnableDisableButtons();
#if 0
if( bar->IsResizable() )
{
bar->SetSize(bar->GetBestFittingSize());
}
#endif
dock->Dock( bar );
Expose( ndx, ndx == DeviceBarID ? false : true );
if( parent )
{
parent->Destroy();
}
}
LayoutToolBars();
Updated();
}
示例2: OnMotion
void ToolBarResizer::OnMotion( wxMouseEvent & event )
{
// Go ahead and set the event to propagate
event.Skip();
// Retrieve the mouse position
wxPoint raw_pos = event.GetPosition();
wxPoint pos = ClientToScreen( raw_pos );
if( event.Dragging() )
{
wxRect r = mBar->GetRect();
wxSize msz = mBar->GetMinSize();
wxSize psz = mBar->GetParent()->GetClientSize();
// Adjust the size by the difference between the
// last mouse and current mouse positions.
r.width += ( pos.x - mResizeStart.x );
// Constrain
if( r.width < msz.x )
{
// Don't allow resizing to go too small
r.width = msz.x;
}
else if( r.GetRight() > psz.x - 3 )
{
// Don't allow resizing to go too large
//
// The 3 magic pixels are because I'm too chicken to change the
// calculations in ToolDock::LayoutToolBars() even though I'm
// the one that set them up. :-)
r.SetRight( psz.x - 3 );
}
else
{
// Remember for next go round
mResizeStart = pos;
}
// Resize the bar
mBar->SetSize( r.GetSize() );
// Tell everyone we've changed sizes
mBar->Updated();
// Refresh our world
mBar->GetParent()->Refresh();
mBar->GetParent()->Update();
}
}
示例3: 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;
//.........这里部分代码省略.........
示例4: Reset
void ToolManager::Reset()
{
int ndx;
// The mInputMeter and mOutputMeter may be in use if audio is playing
// when this happens.
gAudioIO->SetMeters( NULL, NULL );
// Disconnect all docked bars
for( ndx = 0; ndx < ToolBarCount; ndx++ )
{
wxWindow *parent;
ToolDock *dock;
ToolBar *bar = mBars[ ndx ];
// Disconnect the bar
if( bar->IsDocked() )
{
bar->GetDock()->Undock( bar );
parent = NULL;
}
else
{
parent = bar->GetParent();
}
if( ndx == SelectionBarID )
{
dock = mBotDock;
wxCommandEvent e;
bar->GetEventHandler()->ProcessEvent(e);
}
else
{
dock = mTopDock;
bar->ReCreateButtons();
}
bar->EnableDisableButtons();
#if 0
if( bar->IsResizable() )
{
bar->SetSize(bar->GetBestFittingSize());
}
#endif
dock->Dock( bar );
Expose( ndx, true );
if( parent )
{
parent->Destroy();
}
}
// TODO:??
// If audio was playing, we stopped the VU meters,
// It would be nice to show them again, but hardly essential as
// they will show up again on the next play.
// SetVUMeters(AudacityProject *p);
LayoutToolBars();
Updated();
}
示例5: ReadConfig
//.........这里部分代码省略.........
pLegacy,
bar, show[ ndx ], bShownByDefault)
&& found;
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 );
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
示例6: Reset
void ToolManager::Reset()
{
// Disconnect all docked bars
for ( const auto &entry : DefaultConfigTable )
{
int ndx = entry.barID;
ToolBar *bar = mBars[ ndx ].get();
ToolBarConfiguration::Position position {
(entry.rightOf == NoBarID) ? nullptr : mBars[ entry.rightOf ].get(),
(entry.below == NoBarID) ? nullptr : mBars[ entry.below ].get()
};
wxWindow *floater;
ToolDock *dock;
bool expose = true;
// Disconnect the bar
if( bar->IsDocked() )
{
bar->GetDock()->Undock( bar );
floater = NULL;
}
else
{
floater = bar->GetParent();
}
if (ndx == SelectionBarID
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|| ndx == SpectralSelectionBarID
#endif
)
{
dock = mBotDock;
wxCommandEvent e;
bar->GetEventHandler()->ProcessEvent(e);
}
else
{
dock = mTopDock;
bar->ReCreateButtons();
}
bar->EnableDisableButtons();
#if 0
if( bar->IsResizable() )
{
bar->SetSize(bar->GetBestFittingSize());
}
#endif
if( ndx == MeterBarID
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|| ndx == SpectralSelectionBarID
#endif
|| ndx == ScrubbingBarID
)
{
expose = false;
}
if( dock != NULL )
{
// when we dock, we reparent, so bar is no longer a child of floater.
dock->Dock( bar, false, position );
Expose( ndx, expose );
//OK (and good) to DELETE floater, as bar is no longer in it.
if( floater )
floater->Destroy();
}
else
{
// The (tool)bar has a dragger window round it, the floater.
// in turn floater will have mParent (the entire App) as its
// parent.
// Maybe construct a NEW floater
// this happens if we have just been bounced out of a dock.
if( floater == NULL ) {
wxASSERT(mParent);
floater = safenew ToolFrame( mParent, this, bar, wxPoint(-1,-1) );
bar->Reparent( floater );
}
// This bar is undocked and invisible.
// We are doing a reset toolbars, so even the invisible undocked bars should
// be moved somewhere sensible. Put bar near center of window.
// If there were multiple hidden toobars the ndx * 10 adjustment means
// they won't overlap too much.
floater->CentreOnParent( );
floater->Move( floater->GetPosition() + wxSize( ndx * 10 - 200, ndx * 10 ));
bar->SetDocked( NULL, false );
Expose( ndx, false );
}
}
// TODO:??
// If audio was playing, we stopped the VU meters,
//.........这里部分代码省略.........