Ejemplo n.º 1
0
        public BufferButton(int key, Drawing.ButtonDrawer drawer) : base(key)
        {
            bmp    = SBAPI.GenerateBitmapForDK();
            Drawer = drawer;

            Enable();
        }
Ejemplo n.º 2
0
        public override void Disable()
        {
            base.Disable();
            SBAPI.ClearDisplay((SBDisplays)DKey);

            SBAPI.OnDynamicKeyEvent -= SBAPI_OnDynamicKeyEvent;
        }
Ejemplo n.º 3
0
        private void Redraw(bool pressed)
        {
            if (pressed)
            {
                Drawer.DrawPressed(ref bmp);
            }
            else
            {
                Drawer.DrawNormal(ref bmp);
            }

            SBAPI.WriteBitmapImageToSB((SBDisplays)DKey, bmp);
        }
Ejemplo n.º 4
0
        private void priv_RequestTotalRedraw()
        {
            Graphics g = Graphics.FromImage(bmp);

            Draw(ref g);
            RedrawAllChildren(ref g);
            g.Dispose();

            if (Enabled)
            {
                SBAPI.WriteBitmapImageToSB(SBDisplays.TRACKPAD, bmp);
            }
        }
Ejemplo n.º 5
0
 public TPRootPanel()
 {
     if (!SBAPI.Started)
     {
         SBAPI.Start();
     }
     OnEnable               += TPRootPanel_OnEnable;
     SBAPI.OnPressGesture   += SBAPI_OnPressGesture;
     SBAPI.OnReleaseGesture += SBAPI_OnReleaseGesture;
     SBAPI.OnTapGesture     += SBAPI_OnTapGesture;
     SBAPI.OnActivated      += SBAPI_OnActivated;
     SBAPI.OnMoveGesture    += SBAPI_OnMoveGesture;
     renderThread            = new Thread(new ThreadStart(RedrawThreadStart));
     renderThread.Start();
 }
Ejemplo n.º 6
0
        public void Redraw()
        {
            if (inBackground)
            {
                return;
            }
            using (Graphics g = Graphics.FromImage(bmp)) {
                if (Enabled)
                {
                    //fill in the background
                    g.Clear(BackgroundColor);
                    //draw the outline of the bar
                    using (Pen p = new Pen(foregroundBrush)) {
                        g.DrawRectangle(p, BarOutlineRect);
                    }

                    //draw the inner box
                    BarInnerRect = new Rectangle(BarOutlineRect.Location, BarOutlineRect.Size);
                    BarInnerRect.Inflate(new Size(-2, -2));
                    float newWidth = BarInnerRect.Width * CompletionPercent;
                    BarInnerRect.Width = (int)Math.Round(newWidth);
                    g.FillRectangle(foregroundBrush, BarInnerRect);

                    //draw the labels
                    //first, the title label, located just above the bar
                    SizeF textSize = g.MeasureString(Title, titleFont);
                    float textY    = BarOutlineRect.Y - textSize.Height;
                    float textX    = (800 - textSize.Width) / 2;
                    g.DrawString(Title, titleFont, foregroundBrush, new PointF(textX, textY));

                    //now draw the description string!
                    SizeF descSize = g.MeasureString(Description, descFont);
                    float descY    = BarOutlineRect.Y + BarOutlineRect.Height + 3;
                    float descX    = (800 - descSize.Width) / 2;
                    g.DrawString(Description, descFont, foregroundBrush, new PointF(descX, descY));
                }
                else
                {
                    g.Clear(Color.Black);
                }
            }

            SBAPI.WriteBitmapImageToSB(SBDisplays.TRACKPAD, bmp);
        }
Ejemplo n.º 7
0
        public TouchpadProgressBar(int items, string title)
        {
            bmp = SBAPI.GenerateBitmapForTouchpad();


            NumberOfItems  = items;
            Title          = title;
            titleFont      = new Font(FontName, TitleFontSize);
            descFont       = new Font(FontName, DescriptionFontSize);
            BarOutlineRect = new Rectangle((800 - BarWidth) / 2, (480 - BarHeight) / 2, BarWidth, BarHeight);
            BarInnerRect   = new Rectangle(BarOutlineRect.Location, BarOutlineRect.Size);
            BarInnerRect.Inflate(new Size(-2, -2));

            foregroundBrush = new SolidBrush(ForegroundColor);
            backgroundBrush = new SolidBrush(BackgroundColor);

            SBAPI.OnDeactivated += SBAPI_OnDeactivated;
            SBAPI.OnActivated   += SBAPI_OnActivated;
        }
Ejemplo n.º 8
0
 internal override void Redraw()
 {
     SBAPI.SendImageToDK(DKey, true, pressedIcon);
     SBAPI.SendImageToDK(DKey, false, normalIcon);
 }
Ejemplo n.º 9
0
 //called to disable the button
 public virtual void Disable()
 {
     Enabled = false;
     SBAPI.ClearDisplay((SBDisplays)DKey);
 }