Пример #1
0
        public void doMouseClick(int x, int y)
        {
            Point    p   = new Point(x, y);
            DateTime now = DateTime.Now;

            //AppController.sEventLog.WriteLine("seconds: {0}",(now - sLastHit).Seconds);
            if ((now - sLastHit).Seconds < 1)
            {
                return;
            }
            sLastHit = now;
            int i = 0;

            foreach (Rectangle r in mItemRects)
            {
                if (r != null && r.Contains(p))
                {
                    mCurrentMenuIndex = i;
                    AppController.SysClick();
                    mParentForm.draw();
                    DiwiMenuCallbackHandler cb = (DiwiMenuCallbackHandler)mCallbacks[i];
                    if (cb != null)
                    {
                        mCurrentMenuIndex = -1;
                        cb(i, (string)mItems[i]);
                        return;
                    }
                }
                i++;
            }
        }
Пример #2
0
 public void addItem(string text, DiwiMenuCallbackHandler cb, Icon icon)
 {
     mItems.Add(text);
     mCallbacks.Add(cb);
     mItemRects.Add(null);
     if (icon == null)
     {
         mIcons.Add(AppController.sEmptyIcon);
     }
     else
     {
         mIcons.Add(icon);
     }
 }
Пример #3
0
 public void menuSelect()
 {
     if (mCurrentMenuIndex != -1)
     {
         DiwiMenuCallbackHandler cb = (DiwiMenuCallbackHandler)mCallbacks[mCurrentMenuIndex];
         if (cb != null)
         {
             int i = mCurrentMenuIndex;
             mCurrentMenuIndex = -1;
             AppController.SysClick();
             cb(i, (string)mItems[i]);
         }
     }
 }