本文整理汇总了C++中GetScreenPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ GetScreenPosition函数的具体用法?C++ GetScreenPosition怎么用?C++ GetScreenPosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetScreenPosition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetScreenPosition
//Gives the pivot position over the screen
iPoint GuiItem::GetPivotPosition()
{
iPoint ret = pivot;
ret += GetScreenPosition();
return ret;
}
示例2: switch
void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
{
int localkey;
wxPoint pos;
localkey = event.GetKeyCode();
switch( localkey )
{
default:
break;
case WXK_ESCAPE:
m_abortRequest = true;
if( IsMouseCaptured() )
EndMouseCapture();
else
EndMouseCapture( ID_NO_TOOL_SELECTED, m_defaultCursor, wxEmptyString );
break;
}
/* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
* They have an ascii code from 1 to 27 remapped
* to GR_KB_CTRL + 'A' to GR_KB_CTRL + 'Z'
*/
if( event.ControlDown() && localkey >= WXK_CONTROL_A && localkey <= WXK_CONTROL_Z )
localkey += 'A' - 1;
/* Disallow shift for keys that have two keycodes on them (e.g. number and
* punctuation keys) leaving only the "letter keys" of A-Z.
* Then, you can have, e.g. Ctrl-5 and Ctrl-% (GB layout)
* and Ctrl-( and Ctrl-5 (FR layout).
* Otherwise, you'd have to have to say Ctrl-Shift-5 on a FR layout
*/
bool keyIsLetter = ( localkey >= 'A' && localkey <= 'Z' ) ||
( localkey >= 'a' && localkey <= 'z' );
if( event.ShiftDown() && ( keyIsLetter || localkey > 256 ) )
localkey |= GR_KB_SHIFT;
if( event.ControlDown() )
localkey |= GR_KB_CTRL;
if( event.AltDown() )
localkey |= GR_KB_ALT;
INSTALL_UNBUFFERED_DC( DC, this );
// Some key commands use the current mouse position: refresh it.
pos = wxGetMousePosition() - GetScreenPosition();
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
GetParent()->SetMousePosition( pos );
if( !GetParent()->GeneralControl( &DC, pos, localkey ) )
event.Skip();
}
示例3: GetScreenPosition
void
QvisText2DInterface::GetCurrentValues(int which_widget)
{
bool doAll = (which_widget == -1);
if(which_widget == 0 || doAll)
{
// Get the new position
GetScreenPosition(positionEdit, tr("Lower left"));
}
if(which_widget == 1 || doAll)
{
stringVector sv;
sv.push_back(textLineEdit->text().toStdString());
annot->SetText(sv);
}
if(which_widget == 2 || doAll)
{
// Get its new current value and store it in the atts.
ForceSpinBoxUpdate(heightSpinBox);
int w = heightSpinBox->value();
double pos2[3];
pos2[0] = double(w) * 0.01;
pos2[1] = annot->GetPosition2()[1];
pos2[2] = annot->GetPosition2()[2];
annot->SetPosition2(pos2);
}
}
示例4: lc3_init
/** OnInit
*
* Called when the machine needs to be initialized
*/
void ComplxFrame::OnInit(void)
{
static bool first = true;
lc3_init(state, true);
if (console != NULL) delete console;
console = new LC3Console(this);
state.input = &console->inputStream;
state.reader = complx_reader;
state.peek = complx_peek;
state.writer = complx_writer;
// For keyboard interrupts
state.interrupt_test.push_back(complx_step);
console->Show();
int x, y;
GetScreenPosition(&x, &y);
if (first)
{
Move(x + console->GetSize().GetX() / 2, y);
console->Move(x - console->GetSize().GetX() / 2, y);
first = false;
}
else
{
console->Move(x - console->GetSize().GetX(), y);
}
lc3_set_true_traps(state, menuStateTrueTraps->IsChecked());
state.interrupt_enabled = menuStateInterrupts->IsChecked();
state.max_stack_size = stack_size;
state.max_call_stack_size = call_stack_size;
}
示例5: GetScreenPosition
void TWidget::_handle_mouseMove(const TEvent_MouseMoved& event, bool& consume) {
consume = false;
if (IsVisible() == false) {
return;
}
const auto& mousePosition = event;
const auto position = GetScreenPosition();
const auto bounds = position + GetOwnSize();
const bool isOver = IsVisible() &&
isPointInRect(mousePosition.x, mousePosition.y,
position.x, position.y, bounds.x, bounds.y);
if ((isOver == true) && (mouseOver == false)) {
_OnHover();
GetSignal(DefaultSignalID::MouseEntered).Send();
} else if ((isOver == false) && (mouseOver == true)) {
_OnMouseLeave();
GetSignal(DefaultSignalID::MouseLeave).Send();
} else {
/*none*/
}
mouseOver = isOver;
}
示例6: GetPosition
/**
* Returns the position within the parent window.
*/
gcc_pure
const PixelRect GetPosition() const
{
#ifndef USE_GDI
return { GetLeft(), GetTop(), GetRight(), GetBottom() };
#else
PixelRect rc = GetScreenPosition();
HWND parent = ::GetParent(hWnd);
if (parent != NULL) {
POINT pt;
pt.x = rc.left;
pt.y = rc.top;
::ScreenToClient(parent, &pt);
rc.left = pt.x;
rc.top = pt.y;
pt.x = rc.right;
pt.y = rc.bottom;
::ScreenToClient(parent, &pt);
rc.right = pt.x;
rc.bottom = pt.y;
}
return rc;
#endif
}
示例7: ClearDrag
void IDraggable::OnMessageReceived(UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (!IsVisible()) {
if (IsDragged() && !_notifyDragEndEvent(nullptr))
ClearDrag();
return;
}
Utils::Vector2 position(lParam);
IComponent::OnMessageReceived(uMsg, wParam, lParam);
switch(uMsg)
{
case WM_LBUTTONDOWN:
if (!sWndProc.LastMessageHandled) {
if (!IsDragged() && PtInBoundingRect(position) &&
!_notifyDragBeginEvent(&position))
StartDrag(position - GetScreenPosition());
sWndProc.LastMessageHandled |= IsDragged();
}
break;
case WM_LBUTTONUP:
if (IsDragged()) {
if (!_notifyDragEndEvent(&position))
ClearDrag();
sWndProc.LastMessageHandled = true;
}
break;
case WM_MOUSEMOVE:
if (IsDragged() && GetGlobalInterface()->ClipStack.PtInClipArea(position) &&
!_notifyDragMoveEvent(&position)) {
position -= s_dragVector;
auto pParent = GetUIParent();
if (pParent != nullptr)
position -= pParent->GetScreenPosition();
SetPosition(position);
}
sWndProc.LastMessageHandled |= IsDragged();
break;
};
}
示例8: mmCustomFieldDialog
void mmTransDialog::OnCustomFields(wxCommandEvent& /*event*/)
{
const wxString& RefType = Model_Attachment::reftype_desc(Model_Attachment::TRANSACTION);
int TransID = m_trx_data.TRANSID;
if (m_duplicate) TransID = -1;
CustomFieldDialog_ = new mmCustomFieldDialog(this, GetScreenPosition(), GetSize(), RefType, TransID);
CustomFieldDialog_->Show();
}
示例9: GetScreenPosition
RECT IRectComponent::GetFullRect() const {
RECT fullRect = {0};
Utils::Vector2 position = GetScreenPosition();
fullRect.left = static_cast<LONG>(position.x);
fullRect.right = static_cast<LONG>(position.x + GetWidth());
fullRect.top = static_cast<LONG>(position.y);
fullRect.bottom = static_cast<LONG>(position.y + GetHeight());
return fullRect;
}
示例10: GetScreenPosition
NS_IMETHODIMP
BoxObject::GetScreenY(int32_t *_retval)
{
nsIntPoint position;
nsresult rv = GetScreenPosition(position);
if (NS_FAILED(rv)) return rv;
*_retval = position.y;
return NS_OK;
}
示例11: GetScreenPosition
bool TAbstractWindow::_isMouseOverHeader() const {
if (HasHeader() == false) {
return false;
}
const TCoordinate position = GetScreenPosition();
return IO::IsCursorInRect(position.x, position.y,
position.x + size.x, position.y + headerHeight);
}
示例12: GetBestSize
bool wxRibbonPanel::ShowExpanded()
{
if(!IsMinimised())
{
return false;
}
if(m_expanded_dummy != NULL || m_expanded_panel != NULL)
{
return false;
}
wxSize size = GetBestSize();
wxPoint pos = GetExpandedPosition(wxRect(GetScreenPosition(), GetSize()),
size, m_preferred_expand_direction).GetTopLeft();
// Need a top-level frame to contain the expanded panel
wxFrame *container = new wxFrame(NULL, wxID_ANY, GetLabel(),
pos, size, wxFRAME_NO_TASKBAR | wxBORDER_NONE);
m_expanded_panel = new wxRibbonPanel(container, wxID_ANY,
GetLabel(), m_minimised_icon, wxPoint(0, 0), size, m_flags);
m_expanded_panel->SetArtProvider(m_art);
m_expanded_panel->m_expanded_dummy = this;
// Move all children to the new panel.
// Conceptually it might be simpler to reparent this entire panel to the
// container and create a new panel to sit in its place while expanded.
// This approach has a problem though - when the panel is reinserted into
// its original parent, it'll be at a different position in the child list
// and thus assume a new position.
// NB: Children iterators not used as behaviour is not well defined
// when iterating over a container which is being emptied
while(!GetChildren().IsEmpty())
{
wxWindow *child = GetChildren().GetFirst()->GetData();
child->Reparent(m_expanded_panel);
child->Show();
}
// Move sizer to new panel
if(GetSizer())
{
wxSizer* sizer = GetSizer();
SetSizer(NULL, false);
m_expanded_panel->SetSizer(sizer);
}
m_expanded_panel->Realize();
Refresh();
container->Show();
m_expanded_panel->SetFocus();
return true;
}
示例13: GetScreenPosition
void GuiInputBox::Draw()
{
image.Draw();
text.Draw();
if (inputOn)
{
iPoint pos = GetScreenPosition();
App->render->DrawQuad({ pos.x + cursor.x - App->render->camera.x, pos.y - App->render->camera.y, CURSOR_WIDTH, cursor.y }, 255, 255, 255);
}
}
示例14: openFileDialog
void dxfv_wxWidgetsFrame::OnOpen(wxCommandEvent& event)
{
wxFileDialog openFileDialog(this, _("Open DXF file"), "", "", "DXF files (*.dxf)|*.dxf",
wxFD_OPEN|wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() == wxID_CANCEL)
return; // the user changed idea...
dxf->LoadFile( std::string(openFileDialog.GetPath().utf8_str()));
// check for control point splines
for( dxfv::CSpline& spline : dxf->m_Spline ) {
if( ! spline.m_FitPointCount) {
wxMessageBox(
"File contains control point splines\n"
"These will not be displayed",
"WARNING");
break;
}
}
#ifdef DEMO
if( dxf->myLoadStatus == dxfv::CDxf::demo ) {
wxMessageBox( "Demo limit exceeded!", "Sorry");
exit(1);
}
#endif // DEMO
SetTitle( openFileDialog.GetPath() );
dxf->myBoundingRectangle.Fit();
// restart the pan feature
// this stores the current mouse position
// if this is not done here, then a false pan operation
// sometime occurrs on the first display of a newly opened file
old_pos.x = wxGetMousePosition().x - GetScreenPosition().x;
old_pos.y = wxGetMousePosition().y - GetScreenPosition().y - 55;
Refresh();
}
示例15: wxASSERT
/* restores former dialog size and (on Mac) position */
bool CDlgItemProperties::RestoreState() {
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
int iWidth, iHeight;
wxASSERT(pConfig);
if (!pConfig) return false;
pConfig->SetPath(m_strBaseConfigLocation);
pConfig->Read(wxT("Width"), &iWidth, wxDefaultCoord);
pConfig->Read(wxT("Height"), &iHeight, wxDefaultCoord);
#ifndef __WXMAC__
// Set size to saved values or defaults if no saved values
SetSize(iWidth, iHeight);
#else
int iTop, iLeft;
pConfig->Read(wxT("YPos"), &iTop, wxDefaultCoord);
pConfig->Read(wxT("XPos"), &iLeft, wxDefaultCoord);
// If either co-ordinate is less then 0 then set it equal to 0 to ensure
// it displays on the screen.
if ((iLeft < 0) && (iLeft != wxDefaultCoord)) iLeft = 30;
if ((iTop < 0) && (iTop != wxDefaultCoord)) iTop = 30;
// Set size and position to saved values or defaults if no saved values
SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING);
// Now make sure window is on screen
GetScreenPosition(&iLeft, &iTop);
GetSize(&iWidth, &iHeight);
Rect titleRect = {iTop, iLeft, iTop+22, iLeft+iWidth };
InsetRect(&titleRect, 5, 5); // Make sure at least a 5X5 piece visible
RgnHandle displayRgn = NewRgn();
CopyRgn(GetGrayRgn(), displayRgn); // Region encompassing all displays
Rect menuRect = ((**GetMainDevice())).gdRect;
menuRect.bottom = GetMBarHeight() + menuRect.top;
RgnHandle menuRgn = NewRgn();
RectRgn(menuRgn, &menuRect); // Region hidden by menu bar
DiffRgn(displayRgn, menuRgn, displayRgn); // Subtract menu bar region
if (!RectInRgn(&titleRect, displayRgn)) {
iTop = iLeft = 30;
SetSize(iLeft, iTop, iWidth, iHeight, wxSIZE_USE_EXISTING);
}
DisposeRgn(menuRgn);
DisposeRgn(displayRgn);
#endif
return true;
}