本文整理汇总了C++中wxMouseEvent::GetLogicalPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ wxMouseEvent::GetLogicalPosition方法的具体用法?C++ wxMouseEvent::GetLogicalPosition怎么用?C++ wxMouseEvent::GetLogicalPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxMouseEvent
的用法示例。
在下文中一共展示了wxMouseEvent::GetLogicalPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRightClick
bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
{
wxPoint pos;
wxMenu MasterMenu;
INSTALL_UNBUFFERED_DC( dc, this );
pos = event.GetLogicalPosition( dc );
if( !GetParent()->OnRightClick( pos, &MasterMenu ) )
return false;
GetParent()->AddMenuZoomAndGrid( &MasterMenu );
pos = event.GetPosition();
m_ignoreMouseEvents = true;
PopupMenu( &MasterMenu, pos );
// The ZoomAndGrid menu is only invoked over empty space so there's no point in warping
// the cursor back to the crosshair, and it's very annoying if one clicked out of the menu.
m_ignoreMouseEvents = false;
return true;
}
示例2: OnTextureMouseMove
void ManageFieldTextureDialog::OnTextureMouseMove(wxMouseEvent& event) {
if (event.LeftIsDown()) {
if (prevent_event)
return;
prevent_event = true;
m_texturewindow->SetFocusIgnoringChildren();
if (color_selected!=-1) {
/* wxClientDC dc(m_texturewindow);
m_texturewindow->DoPrepareDC(dc);
wxPoint mpos = event.GetLogicalPosition(dc);
int timx = min(max(int(mpos.x*scale_ratio),0),tim.GetWidth()-1);
int timy = min(max(int(mpos.y*scale_ratio),0),tim.height-1);
tim.SetPixelValue(timx,timy,color_selected,char_flag ? m_palettelist->GetSelection()%2 : -1);
UpdateTexturePreview(wxID_PALETTE);*/
} else if (imported_img.IsOk()) {
wxClientDC dc(m_texturewindow);
m_texturewindow->DoPrepareDC(dc);
wxPoint mpos = event.GetLogicalPosition(dc);
imported_img_x = min(max(int(mpos.x*scale_ratio-imported_img_width/2),m_textureposx->GetMin()),m_textureposx->GetMax());
imported_img_y = min(max(int(mpos.y*scale_ratio-imported_img_height/2),m_textureposy->GetMin()),m_textureposy->GetMax());
m_textureposx->SetValue(imported_img_x);
m_textureposy->SetValue(imported_img_y);
DrawImage(dc);
}
prevent_event = false;
}
}
示例3: mouseMoved
void CurvePane::mouseMoved(wxMouseEvent& event)
{
int m=10;
int w, h;
mousemoved = true;
wxClientDC dc(this);
dc.GetSize(&w, &h);
if( mousemotion) {
pos = event.GetLogicalPosition(dc);
pos.x = pos.x-m;
pos.y = h-m-pos.y;
if (selectedCP.x > -1.0) {
c.deletepoint(selectedCP.x, selectedCP.y);
selectedCP.x -= mouseCP.x - (double) pos.x;
selectedCP.y -= mouseCP.y - (double) pos.y;
if (selectedCP.x < 0.0) selectedCP.x = 0.0; if (selectedCP.x > 255.0) selectedCP.x = 255.0;
if (selectedCP.y < 0.0) selectedCP.y = 0.0; if (selectedCP.y > 255.0) selectedCP.y = 255.0;
c.insertpoint((double) selectedCP.x, (double) selectedCP.y);
}
mouseCP.x = (double) pos.x;
mouseCP.y = (double) pos.y;
paintNow();
}
}
示例4: OnMouseMotion
void ExplainCanvas::OnMouseMotion(wxMouseEvent &ev)
{
ev.Skip(true);
if (ev.Dragging())
return;
wxClientDC dc(this);
PrepareDC(dc);
wxPoint logPos(ev.GetLogicalPosition(dc));
double x, y;
x = (double) logPos.x;
y = (double) logPos.y;
// Find the nearest object
int attachment = 0;
ExplainShape *nearestObj = dynamic_cast<ExplainShape *>(FindShape(x, y, &attachment));
if (nearestObj)
{
ShowPopup(nearestObj);
}
}
示例5: OnLeftClick
void RegRichTextCtrl::OnLeftClick( wxMouseEvent& event )
{
SetFocus();
wxClientDC dc(this);
PrepareDC(dc);
dc.SetFont(GetFont());
long position = 0;
int hit = GetBuffer().HitTest(dc, event.GetLogicalPosition(dc), position);
if (hit != wxRICHTEXT_HITTEST_NONE)
{
bool caretAtLineStart = false;
if (hit & wxRICHTEXT_HITTEST_BEFORE)
{
// If we're at the start of a line (but not first in para)
// then we should keep the caret showing at the start of the line
// by showing the m_caretAtLineStart flag.
wxRichTextParagraph* para = GetBuffer().GetParagraphAtPosition(position);
wxRichTextLine* line = GetBuffer().GetLineAtPosition(position);
if (line && para &&
line->GetAbsoluteRange().GetStart() == position
&& para->GetRange().GetStart() != position)
caretAtLineStart = true;
position--;
}
MoveCaret(position, caretAtLineStart);
SelectWord(GetCaretPosition());
}
}
示例6: OnAnimClick
void ManageFieldTextureDialog::OnAnimClick(wxMouseEvent& event) {
wxClientDC dc(m_animlist);
wxPoint mpos = event.GetLogicalPosition(dc);
wxPoint mrpos = event.GetPosition();
int button,col,hitflags;
button = mpos.x/20; // Not that great... Problems if HScroll is enabled
col = m_animlist->HitTest(mrpos,hitflags);
if (button>=0 && button<3 && col>=0 && col<field.anim_amount) {
switch (button) {
case 0: // Loop
if (anim_play_flag[col] & ANIM_PLAYFLAG_LOOP)
anim_play_flag[col] &= ~ANIM_PLAYFLAG_LOOP;
else
anim_play_flag[col] |= ANIM_PLAYFLAG_LOOP;
break;
case 1: // Play/Pause
if (anim_play_flag[col] & ANIM_PLAYFLAG_PLAY)
anim_play_flag[col] &= ~ANIM_PLAYFLAG_PLAY;
else
anim_play_flag[col] |= ANIM_PLAYFLAG_PLAY;
break;
case 2: // Stop
anim_play_flag[col] &= ~ANIM_PLAYFLAG_PLAY;
anim_tile_pos[col] = 0;
anim_tick_time[col] = field.anim[col].tile_duration[0];
m_tilechecklist->Check(field.anim[col].tile_list[0],true);
for (unsigned int i=1;i<field.anim[col].tile_amount;i++)
m_tilechecklist->Check(field.anim[col].tile_list[i],false);
UpdateTexturePreview(wxID_TILE);
break;
}
m_animlist->SetItemImage(col,anim_play_flag[col]);
}
}
示例7: OnEvent
// This implements a tiny doodling program! Drag the mouse using the left
// button.
void MyCanvas::OnEvent(wxMouseEvent& event)
{
wxClientDC dc(this);
PrepareDC(dc);
wxPoint pt(event.GetLogicalPosition(dc));
static long xpos = -1;
static long ypos = -1;
if (xpos > -1 && ypos > -1 && event.Dragging())
{
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(xpos, ypos, pt.x, pt.y);
m_dirty = true;
}
else
{
event.Skip();
}
xpos = pt.x;
ypos = pt.y;
}
示例8: OnMouseLeftDown
void NassiDiagramWindow::OnMouseLeftDown(wxMouseEvent &event)
{
wxClientDC dc(this);
DoPrepareDC(dc);
RemoveDrawlet(dc);
wxPoint pos = event.GetLogicalPosition(dc);
m_view->OnMouseLeftDown(event, pos);
this->SetFocus();
}
示例9: OnMouse
void SpectDisplay::OnMouse(wxMouseEvent& event)
{//========================================
int frame;
int ix;
SetFocus();
if(event.RightDown())
{
PopupMenu(menu_spectdisplay);
return;
}
wxClientDC dc(this);
PrepareDC(dc);
wxPoint pt(event.GetLogicalPosition(dc));
if(spectseq->numframes==0) return;
frame = (int)(pt.y/(FRAME_HEIGHT*zoomy));
if(!event.ControlDown())
spectseq->SelectAll(0);
if(event.ShiftDown())
{
if(sframe >= 0)
{
if(frame < sframe)
for(ix=frame; ix<=sframe; ix++)
spectseq->frames[ix]->selected =1;
else
for(ix=sframe; ix<=frame && ix<spectseq->numframes; ix++)
spectseq->frames[ix]->selected =1;
Refresh();
}
}
else
{
if(frame < spectseq->numframes)
spectseq->frames[frame]->selected ^= 1;
Refresh();
}
if(frame < spectseq->numframes)
{
formantdlg->GetValues(spectseq,sframe);
if(sframe != frame)
formantdlg->ShowFrame(spectseq,frame,pk_num,0xff);
sframe = frame;
}
} // end of SpectDisplay::OnMouse
示例10: OnMouseEvent
// This implements a tiny doodling program. Drag the mouse using
// the left button.
void MyCanvas::OnMouseEvent(wxMouseEvent& event)
{
if (!view)
return;
static DoodleSegment *currentSegment = (DoodleSegment *) NULL;
wxClientDC dc(this);
PrepareDC(dc);
dc.SetPen(*wxBLACK_PEN);
wxPoint pt(event.GetLogicalPosition(dc));
if (currentSegment && event.LeftUp())
{
if (currentSegment->lines.GetCount() == 0)
{
delete currentSegment;
currentSegment = (DoodleSegment *) NULL;
}
else
{
// We've got a valid segment on mouse left up, so store it.
DrawingDocument *doc = (DrawingDocument *)view->GetDocument();
doc->GetCommandProcessor()->Submit(new DrawingCommand(_T("Add Segment"), DOODLE_ADD, doc, currentSegment));
view->GetDocument()->Modify(true);
currentSegment = (DoodleSegment *) NULL;
}
}
if (xpos > -1 && ypos > -1 && event.Dragging())
{
if (!currentSegment)
currentSegment = new DoodleSegment;
DoodleLine *newLine = new DoodleLine;
newLine->x1 = (long)xpos;
newLine->y1 = (long)ypos;
newLine->x2 = pt.x;
newLine->y2 = pt.y;
currentSegment->lines.Append(newLine);
dc.DrawLine( (long)xpos, (long)ypos, pt.x, pt.y);
}
xpos = pt.x;
ypos = pt.y;
}
示例11: OnEvent
// This implements a tiny doodling program! Drag the mouse using
// the left button.
void MyCanvas::OnEvent(wxMouseEvent& event)
{
wxClientDC dc(this);
PrepareDC(dc);
wxPoint pt(event.GetLogicalPosition(dc));
if (xpos > -1 && ypos > -1 && event.Dragging())
{
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(xpos, ypos, pt.x, pt.y);
}
xpos = pt.x;
ypos = pt.y;
}
示例12: OnMouseMove
void NassiDiagramWindow::OnMouseMove(wxMouseEvent &event)
{
wxClientDC dc(this);
DoPrepareDC(dc);
RemoveDrawlet(dc);
wxPoint pos = event.GetLogicalPosition(dc);
m_hd = m_view->OnMouseMove(event, pos);
if ( m_hd && !m_hd->Draw(dc) )
{
delete m_hd;
m_hd = 0;
}
}
示例13: OnLeftDown
void MainFrame::OnLeftDown( wxMouseEvent& event )
{
wxWindowDC dc(source_image);
wxPoint point = event.GetLogicalPosition(dc);
wxColour color;
dc.GetPixel(point, &color);
Control::getInstance()->setTargetColor(color.Red(), color.Green(),
color.Blue());
// process the image
Control::getInstance()->process();
//show the result image;
this->processed_image->SetBitmap(Control::getInstance()->getResult());
//set the color button
this->color_button->SetColour(color);
}
示例14: OnMouseEvent
// This implements a tiny doodling program. Drag the mouse using the left
// button.
void MyCanvas::OnMouseEvent(wxMouseEvent& event)
{
if ( !m_view )
return;
wxClientDC dc(this);
PrepareDC(dc);
dc.SetPen(*wxBLACK_PEN);
const wxPoint pt(event.GetLogicalPosition(dc));
// is this the end of the current segment?
if ( m_currentSegment && event.LeftUp() )
{
if ( !m_currentSegment->IsEmpty() )
{
// We've got a valid segment on mouse left up, so store it.
DrawingDocument * const
doc = wxStaticCast(m_view->GetDocument(), DrawingDocument);
doc->GetCommandProcessor()->Submit(
new DrawingAddSegmentCommand(doc, *m_currentSegment));
doc->Modify(true);
}
delete m_currentSegment;
m_currentSegment = NULL;
}
// is this the start of a new segment?
if ( m_lastMousePos != wxDefaultPosition && event.Dragging() )
{
if ( !m_currentSegment )
m_currentSegment = new DoodleSegment;
m_currentSegment->AddLine(m_lastMousePos, pt);
dc.DrawLine(m_lastMousePos, pt);
}
m_lastMousePos = pt;
}
示例15: OnMouse
void ProsodyDisplay::OnMouse(wxMouseEvent& event)
{//============================================
int line;
int ix;
int xpos=0;
wxClientDC dc(this);
PrepareDC(dc);
wxPoint pt(event.GetLogicalPosition(dc));
if(selected_ph >= 0)
{
// find line for previously selected phoneme
for(line=0; line<num_lines; line++)
if(linetab[line+1] > selected_ph) break;
RefreshLine(line);
selected_ph = -1;
}
line = pt.y / FRAMEHEIGHT;
// find which phoneme is selected on this line
for(ix=linetab[line]; (ix<linetab[line+1]) && (ix<numph); ix++)
{
xpos += GetWidth(&phlist[ix]);
if(xpos > pt.x)
{
selected_ph = ix;
SelectPh(selected_ph);
break;
}
}
RefreshLine(line);
if(event.RightDown())
{
PopupMenu(menu_prosody);
}
} // end of ProsodyDisplay::OnMouse