コード例 #1
0
ファイル: IGraphics.cpp プロジェクト: b-vesco/wdl-ol
int IGraphics::GetMouseControlIdx(int x, int y, bool mo)
{
	if (mMouseCapture >= 0) {
		return mMouseCapture;
	}
  
  bool allow; // this is so that mouseovers can still be called when a control is greyed out

	// The BG is a control and will catch everything, so assume the programmer
	// attached the controls from back to front, and return the frontmost match.
  int i = mControls.GetSize() - 1;
  IControl** ppControl = mControls.GetList() + i;
	for (/* */; i >= 0; --i, --ppControl) {
    IControl* pControl = *ppControl;
    
    if (mo) {
      if (pControl->GetMOWhenGrayed())
        allow = true;
      else
        allow = !pControl->IsGrayed();
    }
    else {
      allow = !pControl->IsGrayed();
    }

    if (!pControl->IsHidden() && allow && pControl->IsHit(x, y)) {
      return i;
    }
	}
	return -1;
}