⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwlib.inl

📁 windows mobile phone source code
💻 INL
📖 第 1 页 / 共 3 页
字号:
/*
 * pwlib.inl
 *
 * GUI inline function implmentations.
 *
 * Portable Windows Library
 *
 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 * the License for the specific language governing rights and limitations
 * under the License.
 *
 * The Original Code is Portable Windows Library.
 *
 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
 *
 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
 * All Rights Reserved.
 *
 * Contributor(s): ______________________________________.
 *
 * $Log: pwlib.inl,v $
 * Revision 1.39  2000/07/11 18:24:02  robertj
 * Fixed incorrect return value on PComboBox::GetCurrent() when no selection.
 *
 * Revision 1.38  2000/04/13 01:37:14  robertj
 * Added missing implementation of PEditBox::GetSelection() on Win32.
 * Added PEditBox::ReplaceSelection() function.
 *
 * Revision 1.37  2000/03/17 20:32:22  robertj
 * Fixed race conditions in mult-threaded windows (dialogs in particular)
 *
 * Revision 1.36  1999/11/13 14:18:50  robertj
 * Moved scrollBar nudge routines to platform dependent code
 *
 * Revision 1.35  1999/08/17 03:44:30  robertj
 * Fixed WIN32 version of function.
 *
 * Revision 1.34  1999/08/07 07:13:22  robertj
 * Fixed problems with "balloon help" text popup.
 *
 * Revision 1.33  1998/09/24 03:41:37  robertj
 * Added open software license.
 *
 * Revision 1.32  1998/09/21 13:30:57  robertj
 * Changes to support new PListView class. Different call back method.
 *
 * Revision 1.31  1998/03/20 03:13:44  robertj
 * Added function to get physical bounds of canvas. Allows to scale drawing.
 *
 * Revision 1.30  1998/02/06 04:00:17  robertj
 * Fixed colour of controls, again!
 *
 * Revision 1.29  1996/11/04 03:33:14  robertj
 * Fixed bug in background colour of dialogs.
 *
 * Revision 1.28  1996/06/03 09:58:05  robertj
 * Added PInteractor FromScreen/ToScreen for individual ordinates.
 *
 * Revision 1.27  1996/02/15 14:51:57  robertj
 * Fixed bug in choice box get text, could crash heap.
 *
 * Revision 1.26  1996/01/28 03:04:16  robertj
 * Added assert into all Compare functions to assure comparison between compatible objects.
 *
 * Revision 1.25  1996/01/02 12:59:18  robertj
 * Added find interactor function.
 *
 * Revision 1.24  1995/11/09 12:36:23  robertj
 * Fixed bug in control colours.
 *
 * Revision 1.23  1995/10/14 15:16:41  robertj
 * Changed SetChoice to SetSelection for consistencies sake.
 * Added function for getting ssytem colour.
 *
 * Revision 1.22  1995/06/04 12:50:54  robertj
 * Added Add component functions.
 * Added common constructor - Unix implementation requirement.
 *
 * Revision 1.21  1995/04/25 11:41:32  robertj
 * Fixed Borland compiler warnings.
 *
 * Revision 1.20  1995/04/22 01:03:02  robertj
 * Added common construct function for multi-line edit box.
 *
 * Revision 1.19  1995/02/19 04:16:07  robertj
 * Moved PListBox::SetSelection to cxx file.
 * Added callback when PListBox::SetSelection changes selection.
 *
 * Revision 1.18  1995/01/28  07:28:47  robertj
 * Assured all Windows strings have \n converted to \r\n and vice versa.
 *
 * Revision 1.17  1995/01/27  11:22:29  robertj
 * Underscored library variables.
 *
 * Revision 1.16  1995/01/22  07:29:48  robertj
 * Added font & colour standard dialogs.
 *
 * Revision 1.15  1995/01/21  05:19:33  robertj
 * Fixed parameters.
 *
 * Revision 1.14  1995/01/15  04:53:39  robertj
 * Moved function to interact.cxx
 *
 * Revision 1.13  1995/01/06  10:44:03  robertj
 * Changed PRealFont usage from pointer to reference.
 *
 * Revision 1.12  1995/01/03  09:41:59  robertj
 * Removed copy stuff for sub menus.
 *
 * Revision 1.11  1995/01/02  12:26:19  robertj
 * Added update flag to list box select.
 *
 * Revision 1.10  1994/12/21  11:58:26  robertj
 * Documentation and variable normalisation.
 *
 * Revision 1.9  1994/12/14  11:17:23  robertj
 * Changed PDIMENSION to be unsigned causing untold number of changes.
 *
 * Revision 1.8  1994/12/05  11:34:30  robertj
 * Major rewrite of images, pictures and pixmaps.
 * Renamed PPict, PPixels and PImage to make sure all uses are found.
 *
 * Revision 1.7  1994/10/30  11:43:27  robertj
 * Improved DC creation in RedrawCanvas.
 * Added functions to check for in clip region.
 * Changed mechanism for doing notification callback functions.
 *
 * Revision 1.6  1994/10/23  05:51:04  robertj
 * Shortened OS error assert.
 * Changed windows message handling technique.
 *
 * Revision 1.5  1994/08/21  23:43:02  robertj
 * Moved some destructors from common.
 * Added delayed close of interactors to avoid the "delete this" problem.
 *
 * Revision 1.4  1994/07/27  05:58:07  robertj
 * Synchronisation.
 *
 * Revision 1.3  1994/07/17  10:46:06  robertj
 * Enhancements, bug fixes etc.
 *
 * Revision 1.2  1994/06/25  11:55:15  robertj
 * Unix version synchronisation.
 *
 * Revision 1.1  1994/04/20  12:17:44  robertj
 * Initial revision
 */



///////////////////////////////////////////////////////////////////////////////
// PDim

PINLINE PDim PDim::FromDWORD(DWORD dw)
  { return PDim(LOWORD(dw), HIWORD(dw)); }

PINLINE DWORD PDim::ToDWORD() const
  { return MAKELONG(width, height); }


///////////////////////////////////////////////////////////////////////////////
// PPoint

PINLINE PPoint::PPoint()
  { p.x = p.y = 0; }

PINLINE PPoint::PPoint(PORDINATE nx, PORDINATE ny)
  { p.x = nx; p.y = ny; }

PINLINE PPoint::PPoint(const PDim & pt)
  { p.x = pt.Width(); p.y = pt.Height(); }

PINLINE PPoint::PPoint(const PPoint & pt)
  { p.x = pt.p.x; p.y = pt.p.y; }


PINLINE PORDINATE PPoint::X() const
  { return (PORDINATE)p.x; }

PINLINE PORDINATE PPoint::Y() const
  { return (PORDINATE)p.y; }

PINLINE void PPoint::SetX(PORDINATE nx)
  { p.x = nx; }

PINLINE void PPoint::SetY(PORDINATE ny)
  { p.y = ny; }

PINLINE void PPoint::AddX(PORDINATE nx)
  { p.x += nx; }

PINLINE void PPoint::AddY(PORDINATE ny)
  { p.y += ny; }

PINLINE PPoint & PPoint::operator+=(const PPoint & pt)
  { p.x += pt.p.x; p.y += pt.p.y; return *this; }

PINLINE PPoint & PPoint::operator+=(const PDim & dim)
  { p.x += dim.Width(); p.y += dim.Height(); return *this; }

PINLINE PPoint & PPoint::operator-=(const PPoint & pt)
  { p.x -= pt.p.x; p.y -= pt.p.y; return *this; }

PINLINE PPoint & PPoint::operator-=(const PDim & dim)
  { p.x -= dim.Width(); p.y -= dim.Height(); return *this; }

PINLINE PPoint & PPoint::operator*=(const PPoint & pt)
  { p.x *= pt.p.x; p.y *= pt.p.y; return *this; }

PINLINE PPoint & PPoint::operator*=(const PDim & dim)
  { p.x *= dim.Width(); p.y *= dim.Height(); return *this; }

PINLINE PPoint & PPoint::operator*=(PORDINATE scale)
  { p.x *= scale; p.y *= scale; return *this; }

PINLINE PPoint & PPoint::operator/=(const PPoint & pt)
  { p.x /= pt.p.x; p.y /= pt.p.y; return *this; }

PINLINE PPoint & PPoint::operator/=(const PDim & dim)
  { p.x /= dim.Width(); p.y /= dim.Height(); return *this; }

PINLINE PPoint & PPoint::operator/=(PORDINATE scale)
  { p.x /= scale; p.y /= scale; return *this; }

PINLINE BOOL PPoint::InRect(const PRect & rect) const
  { return PtInRect(rect, p); }

PINLINE DWORD PPoint::ToDWORD() const
  { return MAKELONG(p.x, p.y); }


PINLINE PPoint::operator POINT() const
  { return p; }

PINLINE PPoint::operator POINT*()
  { return &p; }

PINLINE PPoint::operator const POINT*() const
  { return &p; }


///////////////////////////////////////////////////////////////////////////////
// PRect

PINLINE PRect::PRect(const RECT & rect)
  { CopyRect(&r, &rect); }


PINLINE PORDINATE PRect::Left() const
  { return (PORDINATE)r.left; }

PINLINE PORDINATE PRect::Right() const
  { return (PORDINATE)r.right; }

PINLINE PORDINATE PRect::Top() const
  { return (PORDINATE)r.top; }

PINLINE PORDINATE PRect::Bottom() const
  { return (PORDINATE)r.bottom; }


PINLINE PORDINATE PRect::X() const
  { return (PORDINATE)r.left; }

PINLINE PORDINATE PRect::Y() const
  { return (PORDINATE)r.top; }

PINLINE PDIMENSION PRect::Width() const
  { return (PDIMENSION)(r.right - r.left); }

PINLINE PDIMENSION PRect::Height() const
  { return (PDIMENSION)(r.bottom - r.top); }


PINLINE void PRect::SetWidth(PDIMENSION dx)
  { r.right = r.left + dx; }

PINLINE void PRect::SetHeight(PDIMENSION dy)
  { r.bottom = r.top + dy; }


PINLINE BOOL PRect::ContainsPoint(const PPoint & pt) const
  { return PtInRect(&r, pt); }

PINLINE BOOL PRect::IsEmpty() const
  { return IsRectEmpty(&r); }

PINLINE void PRect::Inflate(PORDINATE dx, PORDINATE dy)
  { InflateRect(&r, (int)dx, (int)dy); }

PINLINE void PRect::Offset(PORDINATE dx, PORDINATE dy)
  { OffsetRect(&r, (int)dx, (int)dy); }


PINLINE PRect::operator RECT*()
  { return &r; }

PINLINE PRect::operator const RECT*() const
  { return &r; }


///////////////////////////////////////////////////////////////////////////////
// PRegion

PINLINE PRegion::PRegion()
  { hRegion = CreateRectRgn(0, 0, 0, 0); }

PINLINE PRegion::PRegion(HRGN hRgn)
  { hRegion = PAssertNULL(hRgn); }

PINLINE PRegion::~PRegion()
  { DeleteObject(hRegion); }


PINLINE HRGN PRegion::GetHRGN() const
  { return hRegion; }

PINLINE BOOL PRegion::ContainsPoint(const PPoint & pt) const
  { return PtInRegion(hRegion, pt.X(), pt.Y()); }

PINLINE BOOL PRegion::ContainsRect(const PRect & rect) const
  { return RectInRegion(hRegion, rect); }

PINLINE void PRegion::Offset(PORDINATE dx, PORDINATE dy)
  { OffsetRgn(hRegion, dx, dy); }


//////////////////////////////////////////////////////////////////////////////
// PColour

PINLINE COLORREF PColour::ToCOLORREF() const
  { return RGB(component[RedComponent],

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -