Пример #1
0
        xBaseControl createCommonTab()
        {
            xContainer c = new xContainer();

            c.setSize(getW() - 6, getH() - 6);
            int y = 0;
            int h = c.getH() / 2 - 10;

            mControlsShouldInvalideAfterNetDone.removeAllElements();

            for (int i = 0; i < mContext.mPriceboard.getIndicesCount(); i++)
            {
                stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexAt(i);
                if (pi == null || pi.code == null)
                {
                    break;
                }
                IndexControl ic = new IndexControl(mListener, pi.marketID, c.getW(), h);
                ic.setPosition(0, y);
                ic.setSize(c.getW(), h);
                y += ic.getBottom() + 10;

                mControlsShouldInvalideAfterNetDone.addElement(ic);

                c.addControl(ic);
            }

            return(c);
        }
Пример #2
0
        xBaseControl createMarketFullControl(stPriceboardStateIndex pi)
        {
            xContainer c = new xContainer();

            c.setSize(getW() - 6, getH() - 6);

            return(c);
        }
Пример #3
0
        public override void onActivate()
        {
            base.onActivate();

            xLabel l = xLabel.createSingleLabel("This is Help screen", null, getW());

            addControl(l);

            xButton bt = xButton.createStandardButton(1000, this, "back to Home screen", 250);

            bt.setPosition(150, 0);
//            bt.setSize(-1, bt.getH()*2);

            Font f = new Font(new FontFamily("Arial"), 13.0f);

            bt.setFont(f);
            bt.setTextColor(Color.Red.ToArgb());

            addControl(bt);

            //====================================try list view=======
            xContainer c = new xContainer();

            c.setSize(235, 200);
            c.setPosition(0, 40);
            addControl(c);

            /*
             * String[] columns = {"CODE", "PRICE", "+/-"};
             * float[] ws = { 50, 100, 80};
             * //  create table
             * xListView lv = xListView.createListView(this, columns, ws, null);
             * for (int i = 0; i < 4; i++)
             * {
             *  columns[0] = "CODE" + i;
             *  columns[1] = "" + (100 * (5-i));
             *  columns[2] = "" + (i * i);
             *  //  create row
             *  xListViewItem item = xListViewItem.createListViewItem(this, 3);//, columns);
             *  for (int j = 0; j < 3; j++)
             *  {
             *      item.setTextForCell(j, columns[j]);
             *  }
             *
             *  lv.addRow(item);
             *  item.setTextColor(1, 0xffff0000);
             * }
             *
             * lv.setSize(230, 100);
             * lv.setPosition(100, 100);
             *
             * c.addControl(lv);
             */
        }
Пример #4
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
            }
        }
Пример #5
0
 public void addControl(xContainer c)
 {
     Controls.Add(c.getControl());
 }
Пример #6
0
        void onPageSelected(int pageIdx)
        {
            mContext.setMarketControlTab(mMarketID, pageIdx);

            int      idx  = TAB_INDEX[pageIdx];
            xTabPage page = mTab.getPageAtIndex(pageIdx);

            if (idx == ID_ONLINE_CHART)
            {
                mRealtimeChart.invalidate();
            }
            else if (idx == ID_CANDLE)
            {
                xContainer c = new xContainer();
                c.setSize(mCurrentChart);

                TodayCandle            candle = new TodayCandle();
                stPriceboardStateIndex pi     = mContext.mPriceboard.getPriceboardIndexOfMarket(mMarketID);
                Share share = mContext.mShareManager.getShare(pi.code);
                candle.setShare(share);

                int w  = mCurrentChart.getW();
                int h  = mCurrentChart.getH();
                int cw = w * 3 / 7;
                if (cw > 160)
                {
                    cw = 160;
                }
                candle.setSize(cw, h);

                c.addControl(candle);

                //  summary
                xBaseControl summary = createMarketSummary(w - cw, h);
                summary.setPosition(cw, 0);
                c.addControl(summary);

                mCurrentChart = c;
                //==============================
                page.resetContent();
                page.addControl(c);
            }
            else if (idx == ID_MONEY_CHART)
            {
                page.resetContent();

                ChartStatistics moneyChart = new ChartStatistics(mMarketID, mListener);
                moneyChart.setSize(mRealtimeChart.getW(), mRealtimeChart.getH() - 18);
                moneyChart.setPosition(mRealtimeChart.getX(), mRealtimeChart.getY());
                moneyChart.setChartType(ChartStatistics.BUBBLE_TRADE_MONEY);

                moneyChart.doCalcChanged();

                page.addControl(moneyChart);

                mCurrentChart = moneyChart;
            }
            else if (idx == ID_VOLUMN_CHART)
            {
                page.resetContent();

                ChartStatistics moneyChart = new ChartStatistics(mMarketID, mListener);
                moneyChart.setSize(mRealtimeChart.getW(), mRealtimeChart.getH() - 18);
                moneyChart.setPosition(mRealtimeChart.getX(), mRealtimeChart.getY());
                moneyChart.setChartType(ChartStatistics.BUBBLE_VOLUME_WEIGHT);

                moneyChart.doCalcChanged();

                page.addControl(moneyChart);

                mCurrentChart = moneyChart;
            }
            else if (idx == ID_INDEX_EFFECT_INC)
            {
                page.resetContent();

                ChartStatistics moneyChart = new ChartStatistics(mMarketID, mListener);
                moneyChart.setSize(mRealtimeChart.getW(), mRealtimeChart.getH() - 18);
                moneyChart.setPosition(mRealtimeChart.getX(), mRealtimeChart.getY());
                moneyChart.setChartType(ChartStatistics.BUBBLE_INDEX_WEIGHT_RATIO_INC);

                moneyChart.doCalcChanged();

                page.addControl(moneyChart);

                mCurrentChart = moneyChart;
            }
            else if (idx == ID_INDEX_EFFECT_DEC)
            {
                page.resetContent();

                ChartStatistics moneyChart = new ChartStatistics(mMarketID, mListener);
                moneyChart.setSize(mRealtimeChart.getW(), mRealtimeChart.getH() - 18);
                moneyChart.setPosition(mRealtimeChart.getX(), mRealtimeChart.getY());
                moneyChart.setChartType(ChartStatistics.BUBBLE_INDEX_WEIGHT_RATIO_DEC);

                moneyChart.doCalcChanged();

                page.addControl(moneyChart);

                mCurrentChart = moneyChart;
            }
        }
Пример #7
0
        protected xContainer createChartRangeControls(int sel, xContainer c)
        {
            Share share        = mContext.getSelectedShare();
            int   currentRange = 0;

            if (share != null)
            {
                currentRange = share.getCursorScope();
            }
            c.removeAllControls();
            //  5 days, 1 month, 3 month, 6 month, 1 year, 2 year
            String[] ss     = { "5d", "1m", "3m", "6m", "1y", "2y", "-", null };
            int[]    scopes = { Share.SCOPE_1WEEKS, Share.SCOPE_1MONTH, Share.SCOPE_3MONTHS, Share.SCOPE_6MONTHS, Share.SCOPE_1YEAR, Share.SCOPE_2YEAR, Share.SCOPE_ALL };
            int      i      = 0;

            int w = 10;
            int h = 20;
            int x = 0;

            //  update sel
            if (currentRange > 0)
            {
                for (i = 0; i < scopes.Length; i++)
                {
                    if (currentRange >= scopes[i])
                    {
                        sel = i;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            if (currentRange > Share.SCOPE_2YEAR)
            {
                sel = scopes.Length - 1;
            }
            //==========================
            i = 0;
            while (ss[i] != null)
            {
                xLabel l = xLabel.createSingleLabel(ss[i], mContext.getFontSmallest(), 25);

                l.setPosition(x, 0);
                l.setAlign(xGraphics.HCENTER);
                l.enableClick(C.ID_CHART_RANGE + i, this);
                c.addControl(l);
                if (i == sel)
                {
                    l.setBackgroundColor(C.COLOR_GRAY_DARK);
                    l.setTextColor(C.COLOR_WHITE);
                }
                else
                {
                    l.setBackgroundColor(C.COLOR_GRAY_LIGHT);
                    l.setTextColor(C.COLOR_BLACK);
                }

                x = l.getRight() + 1;
                h = l.getH();

                i++;
            }
            w = x;
            c.setSize(w, h);
            c.setOpaque(0.7f);

            return(c);
        }
Пример #8
0
        /*
         * protected xBaseControl createShareGroupDroplist(int id, String title, xVector groups)
         * {
         *  xContainer c = new xContainer();
         *  xLabel l = xLabel.createSingleLabel(title, mContext.getFontTextB(), 150);
         *  l.setTextColor(C.COLOR_BLUE);
         *  l.setSize(l.getW(), 16);
         *  int w = 150;
         *  l.setPosition(0, 0);
         *  c.addControl(l);
         *
         *  ComboBox cb = new ComboBox();
         *  c.addControl(cb);
         *  cb.Size = new Size(w, cb.Size.Height);
         *  cb.Left = 0;
         *  cb.Top = l.getBottom();
         *  cb.DropDownStyle = ComboBoxStyle.DropDownList;
         *
         *  stShareGroup current = mContext.getCurrentShareGroup();
         *
         *  for (int i = 0; i < groups.size(); i++)
         *  {
         *      stShareGroup favor = (stShareGroup)groups.elementAt(i);
         *      cb.Items.Add(favor.getName());
         *
         *      if (current != null && favor.getName().CompareTo(current.getName()) == 0)
         *      {
         *          cb.SelectedIndex = i;
         *          mContext.setCurrentShareGroup(favor);
         *      }
         *  }
         *
         *  cb.Tag = (Int32)id;
         *  cb.SelectedIndexChanged += new EventHandler(cb_SelectedIndexChanged);
         *
         *  c.setSize(w, 40);
         *
         *  return c;
         * }
         */

        protected xBaseControl createShareGroupList(bool editable, int id, String title, xVector groups, int w, int h)
        {
            xContainer c = new xContainer();

            c.setSize(w, h);

            Font   f = Context.getInstance().getFontText();
            xLabel l = xLabel.createSingleLabel(title, f, w);

            l.setBackgroundColor(C.COLOR_ORANGE);
            l.setTextColor(C.COLOR_WHITE);

            c.addControl(l);

            int titleH = l.getH();

            xContainer c1 = new xContainer();

            if (editable)
            {
                c1.setSize(w, h - 30 - titleH);
            }
            else
            {
                c1.setSize(w, h - 6 - titleH);
            }
            c1.setPosition(0, l.getH());
            c.addControl(c1);

            stShareGroup current = mContext.getCurrentShareGroup();

            string[]  ss   = { title };
            float[]   cols = { 100.0f };
            xListView list = xListView.createListView(this, ss, cols, w, c1.getH(), Context.getInstance().getImageList(C.IMG_BLANK_ROW_ICON, 1, 21));

            list.hideHeader();
            list.setID(id);
            ((ListView)list.getControl()).HideSelection = false;
            ((ListView)list.getControl()).Scrollable    = true;
            list.setBackgroundColor(C.COLOR_GRAY_DARK);
            int y = 0;

            for (int i = 0; i < groups.size(); i++)
            {
                stShareGroup favor = (stShareGroup)groups.elementAt(i);

                xListViewItem item  = xListViewItem.createListViewItem(this, new string[] { favor.getName() });
                uint          color = C.COLOR_WHITE;
                //if (favor.getGroupType() == stShareGroup.ID_GROUP_MARKET_OVERVIEW)
                //{
                //color = C.COLOR_ORANGE;
                //}
                if (favor.getGroupType() == stShareGroup.ID_GROUP_GAINLOSS)
                {
                    color = C.COLOR_ORANGE;
                }
                item.getItem().SubItems[0].Font      = mContext.getFontText2();
                item.getItem().SubItems[0].ForeColor = Color.FromArgb((int)color);
                item.setData(favor);
                list.addRow(item);
            }

            c1.addControl(list);
            //====================
            if (editable)
            {
                xButton bt;
                bt = xButton.createStandardButton(C.ID_ADD_GROUP, this, "Thêm nhóm", w / 2 - 2);
                bt.setPosition(1, c1.getBottom() + 3);
                c.addControl(bt);

                bt = xButton.createStandardButton(C.ID_REMOVE_GROUP, this, "Xóa nhóm", w / 2 - 2);
                bt.setPosition(w / 2 + 1, c1.getBottom() + 3);
                c.addControl(bt);
            }

            return(c);
        }