Пример #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 setFilterSet(FilterSet filterSet)
        {
            this.filterSet = filterSet;

            if (filterSet.name != null)
            {
                this.textBox1.Text = filterSet.name;
            }

            xVector v = FilterManager.getAvailableSignalItemsAndFilterSet(filterSet);

            vFilters = v;

            int w     = 340;
            int h     = 500;
            int itemH = 30;
            int itemW = w;

            xScrollView scroll = new xScrollView(null, w, h);

            scroll.setSize(w, h);

            w    -= 26;
            itemW = w;

            panel1.Controls.Add(scroll.getControl());

            xContainer container = new xContainer();

            //container.setBackgroundColor(0xff00ff00);
            container.setSize(w, v.size() * itemH);
            //scroll.setControl(container.getControl());

            scroll.addControl(container);

            Context   ctx  = Context.getInstance();
            ImageList imgs = ctx.getImageList(C.IMG_SUB_BUTTONS, 16, 15);

            for (int i = 0; i < v.size(); i++)
            {
                FilterItem item = (FilterItem)v.elementAt(i);
                xContainer c    = new xContainer();
                c.setPosition(0, i * itemH);
                c.setSize(itemW, itemH);

                //  title
                //xLabel l = xLabel.createSingleLabel("asdas ad sad asd");//item.getTitle());

                string s = item.getTitle();
                Utils.trace(s);

                xCheckbox l = xCheckbox.createCheckbox(item.getTitle(), item.selected, null, itemW - 60);

                xFillBackground sep = new xFillBackground(0x80808080);
                sep.setPosition(0, itemH - 1);
                sep.setSize(w, 1);

                xButton setting = null;

                if (item.hasSetting)
                {
                    setting = xButton.createImageButton(0, this, imgs, 0);
                    setting.setPosition(0, (itemH - setting.getH()) / 2);
                    setting.setID(i);

                    l.setPosition(30, (itemH - l.getH()) / 2);
                }
                else
                {
                    l.setPosition(30, (itemH - l.getH()) / 2);
                }

                if (setting != null)
                {
                    c.addControl(setting);
                }

                c.addControl(l);
                c.addControl(sep);

                container.addControl(c);
                //xSco
            }
        }
Пример #3
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);
             */
        }