コード例 #1
0
        public override void setSize(int w, int h)
        {
            base.setSize(w, h);
            if (mCurrentChart != null)
            {
                mCurrentChart.setPosition(0, 0);
                mCurrentChart.setSize(w, h);
                mCurrentChart.invalidate();
                int x, y;
                if (mSettingButton != null)
                {
                    mSettingButton.setPosition(0, (getH() - mSettingButton.getH()) - 1);
                }

                x = mSettingButton.getRight();
                y = mSettingButton.getY();

                if (mDrawGridButton != null)
                {
                    mDrawGridButton.setPosition(x, y);
                    x = mDrawGridButton.getRight();
                }
                if (mSecondChartButton != null)
                {
                    mSecondChartButton.setPosition(x, y);
                    x = mSecondChartButton.getRight();
                }
                if (mHelpButton != null)
                {
                    mHelpButton.setPosition(0, y - mHelpButton.getH());
                }
                //if (mRemoveButton != null)
                //{
                //mAddButton.setPosition(mSwitchButton.getRight(), mSwitchButton.getY());
                //mRemoveButton.setPosition(0, (getH() - mRemoveButton.getH()) - 1);
                //}
            }
        }
コード例 #2
0
        public void setChart(ChartBase c)
        {
            //removeControl(mSwitchButton);
            c.mShouldDrawGrid = mHasGrid;

            removeAllControls();
            //====================================

            if (mCurrentChart != null)
            {
                removeControl(mCurrentChart);
            }

            //  chart
            //addControl(c);
            mCurrentChart = c;
            mCurrentChart.setListener(this);

            Context ctx = Context.getInstance();

            ImageList imgs = ctx.getImageList(C.IMG_SUB_BUTTONS, 16, 15);
            int       x    = 0;
            int       y    = 0;

            //  setting
            if (mSettingButton == null)
            {
                mSettingButton = xButton.createImageButton(C.ID_BUTTON_SETTING_CHART, this, imgs, 0);

                mSettingButton.setPosition(0, (getH() - mSettingButton.getH()) - 1);

                x = mSettingButton.getRight();
            }
            addControl(mSettingButton);
            y = (getH() - mSettingButton.getH()) - 1;
            //  grid
            if (mDrawGridButton == null)
            {
                mDrawGridButton = xButton.createImageButton(C.ID_BUTTON_DRAW_GRID, this, imgs, 4);
                mDrawGridButton.setPosition(x, y);
                x = mDrawGridButton.getRight();
            }
            addControl(mDrawGridButton);
            //  sma
            if (c.isSupportSecondChart())
            {
                if (mSecondChartButton == null)
                {
                    mSecondChartButton = xButton.createImageButton(C.ID_BUTTON_SECOND_CHART, this, imgs, 1);

                    mSecondChartButton.setPosition(x, y);
                    x = mSecondChartButton.getRight();
                }
                addControl(mSecondChartButton);
            }
            //  help
            bool hasHelp   = false;
            int  chartType = c.getChartType();

            if (chartType == ChartBase.CHART_ADL ||
                chartType == ChartBase.CHART_ADX ||
                chartType == ChartBase.CHART_CCI ||
                chartType == ChartBase.CHART_CHAIKIN ||
                chartType == ChartBase.CHART_ICHIMOKU ||
                chartType == ChartBase.CHART_MACD ||
                chartType == ChartBase.CHART_MFI ||
                chartType == ChartBase.CHART_OBV ||
                chartType == ChartBase.CHART_ROC ||
                chartType == ChartBase.CHART_NVI ||
                chartType == ChartBase.CHART_PVI ||
                chartType == ChartBase.CHART_PVT ||
                chartType == ChartBase.CHART_CCI ||
                chartType == ChartBase.CHART_MASSINDEX ||
                chartType == ChartBase.CHART_RSI ||
                chartType == ChartBase.CHART_STOCHASTIC_FAST ||
                chartType == ChartBase.CHART_STOCHASTIC_SLOW ||
                chartType == ChartBase.CHART_STOCHRSI ||
                chartType == ChartBase.CHART_TRIX ||
                chartType == ChartBase.CHART_WILLIAMR ||
                chartType == ChartBase.CHART_VOLUMEBYPRICE)
            {
                hasHelp = true;
            }

            if (mHelpButton == null)
            {
                mHelpButton = xButton.createImageButton(C.ID_BUTTON_CONTEXT_HELP, this, imgs, 3);
                mHelpButton.setPosition(0, y - mHelpButton.getH());
            }
            if (hasHelp)
            {
                addControl(mHelpButton);
            }

            /*
             * if (mRemoveButton == null)
             * {
             * //mAddButton = xButton.createStandardButton(Constants.ID_ADD_SUB_CHART, this, " + ", 30);
             * //mAddButton.setPosition(mSwitchButton.getRight(), mSwitchButton.getY());
             * mRemoveButton = xButton.createStandardButton(C.ID_REMOVE_SUB_CHART, this, " - ", 30);
             * mRemoveButton.setPosition(0, getH() - mRemoveButton.getH()-1);
             * //mRemoveButton.setPosition(mSwitchButton.getRight(), mSwitchButton.getY());
             * }*/

            //addControl(mAddButton);
            //addControl(mRemoveButton);

            addControl(c);

            //  context menu here

            /*
             * //  help
             * img = ctx->getImage("help0.png");
             * img1 = ctx->getImage("help1.png");
             * xUIButton *bt = xUIButton::createImageButton(ID_BUTTON_CONTEXT_HELP, this, 0, img, img1);
             * bt->setPosition(0, mSwitchButton->getY() - mSwitchButton ->getH());
             * addControl(bt);
             */
        }