当前位置: 首页>>代码示例>>C++>>正文


C++ TGadget::IsVisible方法代码示例

本文整理汇总了C++中TGadget::IsVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ TGadget::IsVisible方法的具体用法?C++ TGadget::IsVisible怎么用?C++ TGadget::IsVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TGadget的用法示例。


在下文中一共展示了TGadget::IsVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

//
/// 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


注:本文中的TGadget::IsVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。