本文整理汇总了C++中TGadget类的典型用法代码示例。如果您正苦于以下问题:C++ TGadget类的具体用法?C++ TGadget怎么用?C++ TGadget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TGadget类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetCursorPos
//
/// During idle time, iterates over the Gadgets invoking their CommandEnable()
/// member function. Also detects lost mouse up for fly-over hint mode.
//
bool
TGadgetWindow::IdleAction(long idleCount)
{
if (idleCount == 0) {
// See if we missed a mouse move & still need to send a MouseLeave to a
// gadget
//
if (AtMouse) {
TPoint crsPoint;
GetCursorPos(crsPoint);
if (WindowFromPoint(crsPoint) != GetHandle())
HandleMessage(WM_MOUSEMOVE, 0, MkParam2(-1,-1)); // nowhere
}
}
// Let the gadgets do command enabling if they need to
//
for (TGadget* g = Gadgets; g; g = g->NextGadget())
g->IdleAction(idleCount);
// Chain to base implementation
//
return TWindow::IdleAction(idleCount);
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:29,代码来源:gadgetwi.cpp
示例2: GadgetFromPoint
//
/// Pass RButton messages to the gadget at the mouse location or the one with
/// capture.
///
/// \note The default right-mouse down handler of TGadget does
/// *NOT* set capture
//
void
TGadgetWindow::EvRButtonUp(uint modKeys, const TPoint& point)
{
TGadget* gadget = Capture ? Capture : GadgetFromPoint(point);
if (gadget && (gadget->GetEnabled() || Capture)){
TPoint p(point.x - gadget->GetBounds().left, point.y - gadget->GetBounds().top);
gadget->RButtonUp(modKeys, p);
}
TWindow::EvRButtonUp(modKeys, point);
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:18,代码来源:gadgetwi.cpp
示例3: while
// -----------------------------------------------------------------------------
/// Removes all gadgets from destWindow.
bool
TBarDescr::RemoveGadgets(TGadgetWindow& destWindow)
{
TGadget* gadget = destWindow.FirstGadget();
if(gadget && gadget->GetId() == IDG_FLATHANDLE)
gadget = gadget->NextGadget();
while (gadget) {
TGadget* tmp = gadget;
gadget = gadget->NextGadget();
destWindow.Remove(*tmp);
}
return true;
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:15,代码来源:bardescr.cpp
示例4: EnableTooltip
//
// Create Tooltips for GadgetWindow
//
void
TGadgetWindow::EvCreateTooltips()
{
// If 'WantTooltip' is enabled, created the control
//
if (WantTooltip)
EnableTooltip(true);
// Inform each gadget that the gadgetwindow is now created. This allows
// gadgets to perform initialization [eg. registering with the tooltip] which
// requires the 'HWND' to be valid
//
for (TGadget* g = Gadgets; g; g = g->NextGadget())
g->Created();
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:19,代码来源:gadgetwi.cpp
示例5: desiredSize
//
// Compute the cell size which is determined by the widest and the highest
// gadget
//
void
TToolBox::ComputeCellSize(TSize& cellSize)
{
cellSize.cx = cellSize.cy = 0;
for (TGadget* g = Gadgets; g; g = g->NextGadget()) {
TSize desiredSize(0, 0);
g->GetDesiredSize(desiredSize);
if (desiredSize.cx > cellSize.cx)
cellSize.cx = desiredSize.cx;
if (desiredSize.cy > cellSize.cy)
cellSize.cy = desiredSize.cy;
}
}
开发者ID:GarMeridian3,项目名称:Meridian59,代码行数:21,代码来源:toolbox.cpp
示例6:
//
/// A gadget has been inserted into this gadget window
//
void
TGadgetWindow::Inserted(TGadget& gadget)
{
// Let gadget know that it is now in this window
//
gadget.Window = this;
gadget.Inserted();
// If the gadgetwindow was already created, inform gadget
// so it may perform initialization that requires an HWND
//
if (GetHandle())
gadget.Created();
if (gadget.WideAsPossible)
WideAsPossible++;
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:20,代码来源:gadgetwi.cpp
示例7: PRECONDITION
void
THelpFileManager::CmWhatIsThis()
{
PRECONDITION(LastParent);
if(!LastParent)
return;
LastParent->ScreenToClient(LastHit); // TWindow
HWND hWnd = LastParent->ChildWindowFromPoint(LastHit);
HELPINFO Info;
Info.cbSize = sizeof(Info);
Info.MousePos = LastHit;
if(hWnd){
TGadgetWindow* gwin = TYPESAFE_DOWNCAST(GetWindowPtr(hWnd), TGadgetWindow);
if(gwin){
TGadget* gd = gwin->GadgetFromPoint(LastHit);
if(gd){
Info.iContextType = HELPINFO_MENUITEM;
Info.iCtrlId = gd->GetId();
EvHelp(Info);
}
return;
}
}
Info.iContextType = HELPINFO_WINDOW;
Info.dwContextId = 0;
// If the click wasn't on one of the controls, open Help for dialog.
if (hWnd == 0 || hWnd == LastParent->GetHandle()){
Info.iContextType = HELPINFO_MENUITEM;
Info.iCtrlId = IDHELP;
Info.hItemHandle = LastParent->GetHandle();
}
else{
Info.iCtrlId = ::GetDlgCtrlID(hWnd);
Info.hItemHandle = hWnd;
}
EvHelp(Info);
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:39,代码来源:hlpmanag.cpp
示例8: GadgetReleaseCapture
//
/// This indicates that a gadget has been removed from this gadget window.
//
void
TGadgetWindow::Removed(TGadget& gadget)
{
// Re-adjust gadget now that it doesn't live in a window
//
if (gadget.WideAsPossible)
WideAsPossible--;
// Clear last know gadget as mouse location
//
if (&gadget == AtMouse)
AtMouse = 0;
// Release caption if it has/had it
//
GadgetReleaseCapture(gadget);
// Notify gadget and reset/adjust variables to reflect new state of gadget
//
gadget.Removed();
gadget.Window = 0;
gadget.Next = 0;
gadget.GetBounds() -= gadget.GetBounds().TopLeft();
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:27,代码来源:gadgetwi.cpp
示例9: ComputeCellSize
//
/// Tiles the gadgets in the direction requested (horizontal or vertical). Derived
/// classes can adjust the spacing between gadgets.
///
/// Horizontal direction results in a row-major layout,
/// and vertical direction results in column-major layout
//
TRect
TToolBox::TileGadgets()
{
TSize cellSize;
ComputeCellSize(cellSize);
int numRows, numColumns;
ComputeNumRowsColumns(numRows, numColumns);
TRect innerRect;
GetInnerRect(innerRect);
TRect invalidRect;
invalidRect.SetEmpty();
if (Direction == Horizontal) {
// Row Major
//
int y = innerRect.top;
TGadget* g = Gadgets;
for (int r = 0; r < numRows; r++) {
int x = innerRect.left;
for (int c = 0; c < numColumns && g; c++) {
TRect bounds(TPoint(x, y), cellSize);
TRect originalBounds(g->GetBounds());
if (bounds != g->GetBounds()) {
g->SetBounds(bounds);
if (invalidRect.IsNull())
invalidRect = bounds;
else
invalidRect |= bounds;
if (originalBounds.TopLeft() != TPoint(0, 0))
invalidRect |= originalBounds;
}
x += cellSize.cx;
g = g->NextGadget();
}
y += cellSize.cy;
}
}
else {
// Column Major
//
int x = innerRect.left;
TGadget* g = Gadgets;
for (int c = 0; c < numColumns; c++) {
int y = innerRect.top;
for (int r = 0; r < numRows && g; r++) {
TRect bounds(TPoint(x, y), cellSize);
TRect originalBounds(g->GetBounds());
if (bounds != originalBounds) {
g->SetBounds(bounds);
if (invalidRect.IsNull())
invalidRect = bounds;
else
invalidRect |= bounds;
if (originalBounds.TopLeft() != TPoint(0, 0))
invalidRect |= originalBounds;
}
y += cellSize.cy;
g = g->NextGadget();
}
x += cellSize.cx;
}
}
return invalidRect;
}
开发者ID:GarMeridian3,项目名称:Meridian59,代码行数:88,代码来源:toolbox.cpp
示例10: GetInnerRect
//
/// Helper for LayoutGadgets() to calculate rectangular 2D tiling
//
void
TGadgetWindow::LayoutRectangularly(TLayoutInfo& layout)
{
TRect innerRect;
GetInnerRect(innerRect);
layout.DesiredSize = TSize(0,0);
layout.GadgetBounds = new TRect[NumGadgets];
// !CQ memset((void*)layout.GadgetBounds, 0, sizeof(TRect) * NumGadgets);// Debugging code
int leftM, rightM, topM, bottomM;
GetMargins(Margins, leftM, rightM, topM, bottomM);
// Now tile all the gadgets. Assume no wide-as-possibles.
//
int x = leftM;
int y = topM;
int right = RowWidth - rightM; // Base right margin limit on RowWidth
// If any controls are wider than right margin, push out the right margin.
//
TGadget* gadget;
for (gadget = Gadgets; gadget; gadget = gadget->Next) {
TSize desiredSize;
gadget->GetDesiredSize(desiredSize);
// SIR June 20th 2007 max instead of ::max
right = max(right, (int)(x + desiredSize.cx + rightM));
}
// Scan gadgets, positioning & placing all of the EndOfRow flags
//
TGadget* rowStart; // Tracks the first gadget in the row
TGadget* lastBreak; // Tracks the last gadget in the row
bool contRow = false; // Working on a group continuation row
bool contBreak = false; // Finished group on continuation row
int i = 0;
int istart = 0;
int iend = 0; // Tracks the last visible gadget in the row
int ibreak = 0;
int rowHeight;
rowStart = Gadgets;
lastBreak = Gadgets;
for (gadget = Gadgets; gadget; gadget = gadget->Next, i++) {
gadget->SetEndOfRow(false);
// !CQ ignore wide-as-possible gadget requests
//
TSize desiredSize;
gadget->GetDesiredSize(desiredSize);
TRect bounds = gadget->GetBounds();
// Do the horizontal layout of this control
//
bounds.left = x;
bounds.right = bounds.left + desiredSize.cx;
// Store gadget's height in bottom, so we can calculate the row height
// later
//
bounds.top = 0;
bounds.bottom = desiredSize.cy;
// If too big or a new group on a group continue row, (& is not the first
// & is visible) then back up to iend & reset to lastBreak+1
//
if ((bounds.right > right || contBreak) &&
gadget != rowStart && gadget->IsVisible()) {
lastBreak->SetEndOfRow(true);
// Update gadget window's desired size
//
layout.DesiredSize.cx =
std::max((layout.GadgetBounds[iend].right+rightM), layout.DesiredSize.cx);
// Do the vertical layout of this row
//
FinishRow(istart, rowStart, lastBreak, y, layout, rowHeight);
contRow = lastBreak->IsVisible(); // Next row is a group continuation
x = leftM;
y += rowHeight;
if (!contRow)
y += RowMargin;
gadget = lastBreak; // will get bumped to Next by for incr
i = ibreak; // so will this
rowStart = lastBreak = gadget->Next; // Begin next row
istart = i+1;
contBreak = false;
continue;
}
//.........这里部分代码省略.........
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:101,代码来源:gadgetwi.cpp
示例11: defined
//
/// Sets the horizontal or vertical orientation of the gadgets. If the gadget window
/// is already created, SetDirection readjusts the dimensions of the gadget window
/// to fit around the gadgets.
///
/// The setting of the direction parameter is also related to the setting of the
/// second parameter (TLocation) in TDecoratedFrame's Insert function,. which
/// specifies where the decoration is added in relation to the frame window's client
/// window. If the second parameter in TDecoratedFrame::Insert() is set to top or
/// bottom, the direction parameter in SetDirection must be horizontal. If the
/// second parameter in TDecoratedFrame::Insert() is set to left or right, the
/// direction parameter in SetDirection must be vertical.
//
void
TGadgetWindow::SetDirection(TTileDirection direction)
{
#if defined(BI_COMP_GNUC)
TTileDirection dir = Direction;
if (dir != direction || DirtyLayout) {
if (dir != direction) {
#else
if (((int)Direction) != direction || DirtyLayout) {
// Swap margin's and ShrinkWrap's X & Y axis
//
if (((int)Direction) != direction) {
#endif
// Margin swapping seems to not be used in the latest UIs
//
#if 0
int t = Margins.Left; Margins.Left = Margins.Top; Margins.Top = t;
t = Margins.Right; Margins.Right = Margins.Bottom; Margins.Bottom = t;
#endif
// NOTE: a limitation. Passing thru Rectangular will mess this swap up
//
bool sww = ShrinkWrapWidth;
ShrinkWrapWidth = ShrinkWrapHeight;
ShrinkWrapHeight = sww;
Direction = direction;
DirtyLayout = true;
}
// Get & use the new size & relayout if created
//
UseDesiredSize();
LayoutSession();
}
}
//
/// Set flat style options, or disable it.
//
void
TGadgetWindow::EnableFlatStyle(uint style)
{
if(style == FlatDefault)
{
style = FlatStandard;
uint32 v = TCommCtrl::Dll()->GetCtrlVersion();
if (v > ComCtlVersionIE3)
style |= FlatSingleDiv|FlatGrayButtons;
if (v > ComCtlVersionIE4)
style |= FlatHotText;
if (v >= 0x60000)
style |= FlatXPTheme;
}
FlatStyle = style;
}
//
// Returns true if the application is themed (Windows XP Visual Style).
//
bool
TGadgetWindow::IsThemed() const
{
return (FlatStyle & FlatXPTheme) && TThemeModule::GetInstance().IsAppThemed();
}
//
// Enables or disables themed background.
//
void
TGadgetWindow::EnableThemeBackground(bool enable)
{
ThemeBackgroundMode = enable;
}
//
// Returns true if themed background is enabled.
//
bool
TGadgetWindow::IsThemeBackgroundEnabled() const
{
return ThemeBackgroundMode;
}
//
// Returns true if themed background is enabled and themes are active.
//
//.........这里部分代码省略.........
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:101,代码来源:gadgetwi.cpp
注:本文中的TGadget类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论