本文整理汇总了C++中PushState函数的典型用法代码示例。如果您正苦于以下问题:C++ PushState函数的具体用法?C++ PushState怎么用?C++ PushState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PushState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PushState
/* virtual */ OP_STATUS
Google2011NetworkApiResponseParser::EnterObject()
{
if (m_state_stack_size == 0)
return PushState(MAIN_OBJECT);
else if (m_state_stack_size == 2 && m_state_stack[1] == LOCATION)
return PushState(LOCATION_OBJECT);
else
return PushState(UNKNOWN_OBJECT);
}
示例2: ClearClipboard
void AudioView::Cut()
{
ClearClipboard();
TrackList *tracks = GetTracks();
VTrack *n = tracks->First();
VTrack *dest = 0;
while(n) {
if (n->selected) {
n->Cut(sel0, sel1, &dest);
if (dest)
clipboard->Add(dest);
}
n = tracks->Next();
}
clipLen = (sel1 - sel0);
sel1 = sel0;
PushState();
FixScrollbars();
REDRAW(trackPanel);
REDRAW(rulerPanel);
UpdateMenus();
}
示例3: Clear
void AudioView::Paste()
{
if (sel0 != sel1)
Clear();
wxASSERT(sel0 == sel1);
double tsel = sel0;
TrackList *tracks = GetTracks();
VTrack *n = tracks->First();
VTrack *c = clipboard->First();
while(n && c) {
if (n->selected) {
n->Paste(tsel, c);
c = clipboard->Next();
}
n = tracks->Next();
}
// TODO: What if we clicked past the end of the track?
sel0 = tsel;
sel1 = tsel + clipLen;
PushState();
FixScrollbars();
REDRAW(trackPanel);
REDRAW(rulerPanel);
UpdateMenus();
}
示例4: GetTracks
void AudioView::Pitch()
{
VTrack *t;
bool success = false;
TrackList *tracks = GetTracks();
t = tracks->First();
while(t) {
if (t->selected && t->GetKind() == VTrack::Wave) {
NoteTrack *note = PitchExtract((WaveTrack *)t,
&((AudioDoc *)GetDocument())->dirManager);
if (note) {
success = true;
tracks->Add(note);
}
}
t = tracks->Next();
}
if (success) {
PushState();
FixScrollbars();
REDRAW(trackPanel);
REDRAW(rulerPanel);
}
}
示例5: wxFileSelector
void AudioView::ImportMIDI()
{
wxString fileName =
wxFileSelector("Select a MIDI File...",
"", // Path
"", // Name
".mid", // Extension
"*.mid", // Wildcard
0, // Flags
GetFrame()); // Parent
if (fileName == "")
return;
NoteTrack *newTrack =
new NoteTrack(&((AudioDoc *)GetDocument())->dirManager);
if (::ImportMIDI(fileName, newTrack)) {
SelectNone();
GetTracks()->Add(newTrack);
newTrack->selected = true;
PushState();
FixScrollbars();
REDRAW(trackPanel);
REDRAW(rulerPanel);
}
}
示例6: Draw
virtual void Draw(BRect updateRect)
{
BRegion region;
region.Include(BRect(20, 20, 40, 40));
region.Include(BRect(30, 30, 80, 80));
ConstrainClippingRegion(®ion);
SetHighColor(55, 255, 128, 255);
FillRect(BRect(0, 0, 100, 100));
PushState();
SetOrigin(15, 15);
ConstrainClippingRegion(®ion);
SetHighColor(155, 255, 128, 255);
FillRect(BRect(0, 0, 100, 100));
// ConstrainClippingRegion(NULL);
SetHighColor(0, 0, 0, 255);
StrokeLine(BPoint(2, 2), BPoint(80, 80));
SetHighColor(255, 0, 0, 255);
StrokeLine(BPoint(2, 2), BPoint(4, 2));
PopState();
SetHighColor(0, 0, 0, 255);
StrokeLine(BPoint(4, 2), BPoint(82, 80));
}
示例7: PushState
void NetListView::FrameResized(float width, float height)
{
BListView::FrameResized(width, height);
//Ensure the bevel on the right is drawn properly
if(width < oldWidth)
oldWidth = width;
PushState();
BRect invalRect(oldWidth, 0, oldWidth, height);
ConvertFromParent(&invalRect);
BRegion lineRegion(invalRect);
ConstrainClippingRegion(&lineRegion);
Draw(invalRect);
oldWidth = width;
PopState();
//Do word wrapping
BFont curFont;
GetFont(&curFont);
float itemWidth = Bounds().Width();
float wrapWidth = (itemWidth - 6)/curFont.Size();
for(int itemNum = 0; itemNum < CountItems(); itemNum++)
{
NetListItem* item = (NetListItem*)(Items()[itemNum]);
item->SetWidth(itemWidth);
item->CalcWordWrap(wrapWidth);
}
//DoForEach(UpdateItem, (void*)this);
Invalidate();
BListView::FrameResized(width, height);
}
示例8: iter
void AudacityProject::Trim(wxEvent & event)
{
if (mViewInfo.sel0 >= mViewInfo.sel1)
return;
TrackListIterator iter(mTracks);
VTrack *n = iter.First();
while (n) {
if (n->GetSelected()) {
//Delete the section before the left selector
n->Clear(n->GetOffset(), mViewInfo.sel0);
if (mViewInfo.sel0 > n->GetOffset())
n->SetOffset(mViewInfo.sel0);
//Delete the section after the right selector
n->Clear(mViewInfo.sel1, n->GetMaxLen());
}
n = iter.Next();
}
FixScrollbars();
mTrackPanel->Refresh(false);
PushState(_("Trim file to selection"));
}
示例9: wxFileSelector
void AudacityProject::OnImportMIDI(wxCommandEvent & event)
{
wxString path = gPrefs->Read("/DefaultOpenPath",::wxGetCwd());
wxString fileName = wxFileSelector(_("Select a MIDI file..."),
path, // Path
"", // Name
"", // Extension
_("All files (*.*)|*.*|"
"MIDI files (*.mid)|*.mid|"
"Allegro files (*.gro)|*.gro"),
0, // Flags
this); // Parent
if (fileName != "") {
path =::wxPathOnly(fileName);
gPrefs->Write("/DefaultOpenPath", path);
NoteTrack *newTrack = new NoteTrack(&mDirManager);
if (::ImportMIDI(fileName, newTrack)) {
SelectNone();
mTracks->Add(newTrack);
newTrack->SetSelected(true);
PushState(wxString::Format(_("Imported MIDI from '%s'"),
fileName.c_str()));
FixScrollbars();
mTrackPanel->Refresh(false);
}
}
}
示例10: get_current_theme_engine
void
BBox::Draw(BRect updateRect)
{
if (!IsVisible() || fBorder == B_NO_BORDER) return;
e_theme_engine *theme = get_current_theme_engine();
if (theme == NULL || theme->get_border_margins == NULL || theme->draw_border == NULL) return;
float l = 0, t = 0, r = 0, b = 0;
theme->get_border_margins(theme, this, &l, &t, &r, &b, fBorder, PenSize());
BRect rect = Frame().OffsetToSelf(B_ORIGIN);
if (!(fLabelView == NULL || fLabelView->Frame().Width() <= 0 || fLabelView->Frame().Height() < t))
rect.top += (fLabelView->Frame().Height() - t) / 2.f;
PushState();
BRegion clipping(updateRect);
if (!(fLabelView == NULL || fLabelView->Frame().IsValid() == false)) clipping.Exclude(fLabelView->Frame());
ConstrainClippingRegion(&clipping);
if (clipping.CountRects() > 0) theme->draw_border(theme, this, rect, fBorder, PenSize());
PopState();
}
示例11: switch
void GameEngine::Escaper() //this should be done in seperate class if I'm correct?
{
if(event.type == ALLEGRO_EVENT_KEY_DOWN) //this thing shouldn't be here imo
{
switch(event.keyboard.keycode)
{
case ALLEGRO_KEY_ESCAPE:
if (IsGameStateActive())
{
PushState(menuState);
menuState->SwitchToMenu("Wave Menu");
}
else if (menuState->CurrentMenu->GetName() == "Wave Menu")
{
PopState();
}
break;
case ALLEGRO_KEY_B: //this should seriously be left somewhere else, or this method should change its name
if (IsGameStateActive())
{
if (collisionDetector->IsHitboxDisplayEnabled())
collisionDetector->EnableHitboxDisplay(false);
else
collisionDetector->EnableHitboxDisplay(true);
}
break;
}
}
else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
Quit();
}
示例12: glfwCreateWindow
GameEngine::GameEngine(int argc, char **argv) {
m_running = true;
// pass in glfwGetPrimaryMonitor() to first null for fullscreen
window = glfwCreateWindow(1024, 768, WINDOWTITLE, NULL, NULL);
if (!window)
{
fprintf(stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n");
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window);
// Currently just starts it with the PlayState
PlayState *state = new PlayState(window);
PushState(state);
ChangeState(state);
//Callbacks
glfwSetKeyCallback(window, key_callback);
glfwSetCursorPosCallback(window, mouse_motion);
glfwSetMouseButtonCallback(window, mouse_button);
glfwSetScrollCallback(window, mouse_scroll);
}
示例13: PushState
void VideoEngine::DrawGrid(float x, float y, float x_step, float y_step, const Color &c)
{
PushState();
Move(0, 0);
float x_max = _current_context.coordinate_system.GetRight();
float y_max = _current_context.coordinate_system.GetBottom();
std::vector<GLfloat> vertices;
int32 num_vertices = 0;
for(; x <= x_max; x += x_step) {
vertices.push_back(x);
vertices.push_back(_current_context.coordinate_system.GetBottom());
vertices.push_back(x);
vertices.push_back(_current_context.coordinate_system.GetTop());
num_vertices += 2;
}
for(; y < y_max; y += y_step) {
vertices.push_back(_current_context.coordinate_system.GetLeft());
vertices.push_back(y);
vertices.push_back(_current_context.coordinate_system.GetRight());
vertices.push_back(y);
num_vertices += 2;
}
glColor4fv(&c[0]);
DisableTexture2D();
EnableVertexArray();
glVertexPointer(2, GL_FLOAT, 0, &(vertices[0]));
glDrawArrays(GL_LINES, 0, num_vertices);
PopState();
}
示例14: DM_LOG
bool Mind::EndState()
{
if (!_stateQueue.empty())
{
// Don't destroy the State object this round
_recycleBin = _stateQueue.front();
DM_LOG(LC_AI, LT_INFO)LOGSTRING("Ending State %s (%s)\r", _recycleBin->GetName().c_str(), _owner.GetEntity()->name.c_str());
// Remove the current state from the queue
_stateQueue.pop_front();
// Trigger a stateswitch next round in any case
_switchState = true;
}
if (_stateQueue.empty())
{
// No states left, add the default state at least
PushState(STATE_DEFAULT);
}
// Return TRUE if there are additional states left
return true;
}
示例15: PushState
void TExportZone::DrawInMarker(BRect updateRect)
{
// Set up environment
PushState();
BPoint drawPt;
// Draw left marker
if (updateRect.Intersects(m_InRect) )
{
// Draw indicator in new location
drawPt.Set(m_InRect.left, m_InRect.top);
DrawBitmap(m_InMarker, drawPt);
}
// Draw right marker
if (updateRect.Intersects(m_OutRect) )
{
// Draw indicator in new location
drawPt.Set(m_OutRect.left, m_OutRect.top);
DrawBitmap(m_OutMarker, drawPt);
}
// Restore environment
PopState();
}