public void registerTick(xBaseControl c) { if (!mTickControls.contains(c)) { mTickControls.addElement(c); } }
public MarketsTab(xIEventListener listener, int w, int h) : base(listener) { mTabControl = new xTabControl(); this.setSize(w, h); mContext = Context.getInstance(); mTabControl.setSize(w, h); addControl(mTabControl); // common xTabPage page = new xTabPage("Hose && Hnx"); xBaseControl c = createCommonTab(); page.addControl(c); mTabControl.addPage(page); for (int i = 0; i < mContext.mPriceboard.getIndicesCount(); i++) { stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexAt(i); if (pi == null || pi.code == null) { break; } // Hose page = new xTabPage(pi.code); c = createMarketFullControl(pi); page.addControl(c); mTabControl.addPage(page); } }
public void onEvent(object sender, int evt, int aIntParameter, object aParameter) { xBaseControl c = (xBaseControl)sender; int id = c.getID(); if (id >= 0 && id < vFilters.size()) { FilterItem item = (FilterItem)vFilters.elementAt(id);; for (int i = 0; i < filterSet.getFilterItemCnt(); i++) { FilterItem used = filterSet.getFilterItemAt(i); if (used.type == item.type) { item.param1 = used.param1; item.param2 = used.param2; item.param3 = used.param3; break; } } DlgFilterParamSetting dlg = new DlgFilterParamSetting(); dlg.setFilterItem(item); if (dlg.ShowDialog() == DialogResult.OK) { //FilterManager.getInstance().saveFilterSets(); } } }
void _renderToView(String code, xGraphics g, xBaseControl view) { mCode = code; graphics = g; Rectangle rc = new Rectangle(view.getX(), view.getY(), view.getW(), view.getH()); _renderToView(code, g, rc); }
override public void setSize(xBaseControl c) { base.setSize(c.getW(), c.getH()); clearModifyKey(); if (mDrawer != null) { mDrawer.recalcPosition(); } }
public override void render(xGraphics g) { for (int i = 0; i < mCharts.Length; i++) { xBaseControl c = (xBaseControl)mCharts[i]; if (c != null) { c.render(g); } } }
public void addViewAsTab(String title, xBaseControl content) { xTabPage page = new xTabPage(title); content.setSize(mTab.getW(), mTab.getH()); page.addControl(content); mTab.addPage(page); mTab.selectLastPage(); }
public void onSelectItem(xBaseControl c) { for (int i = 0; i < vRows.size(); i++) { xBaseControl vo = (xBaseControl)vRows.elementAt(i); if (vo == c) { mSelectedIndex = i; break; } } }
public override void onMouseUp(int x, int y) { for (int i = 0; i < mCharts.Length; i++) { xBaseControl c = (xBaseControl)mCharts[i]; if (c != null) { c.onMouseUp(x, y); break; } } }
public AlarmDialog(ScreenBase screen, int firedCnt, xBaseControl c) { InitializeComponent(); panel_Alarm.Controls.Add(c.getControl()); panel_Alarm.AutoScroll = true; this.label1.Text = "Có tất cả <" + firedCnt + "> Cảnh báo được bật"; mControl = c; mScreen = screen; }
static public void renderToView(String code, xGraphics g, xBaseControl view) { DrawAChartDelegator sharedInstance = (DrawAChartDelegator)GlobalData.vars().getValue("DrawAChartDelegator"); if (sharedInstance == null) { sharedInstance = new DrawAChartDelegator(); GlobalData.vars().setValue("DrawAChartDelegator", sharedInstance); } sharedInstance._renderToView(code, g, view); }
public override void setSize(int w, int h) { base.setSize(w, h); for (int i = 0; i < mCharts.Length; i++) { xBaseControl c = (xBaseControl)mCharts[i]; if (c != null) { c.setSize(this); break; } } }
void showRealtimeChart() { if (STATE_SHOWING_REALTIME == mState) { for (int i = 0; i < mRealtimes.size(); i++) { xBaseControl c = (xBaseControl)mRealtimes.elementAt(i); removeControl(c); } mRealtimes.removeAllElements(); Invalidate(); mState = STATE_NORMAL; MainApplication.getInstance().setSize(getW(), MINI_H); } else { int rW = getW() / 2; int rH = 200; int newH = getH() + rH; int x = 0; int y = MINI_H; MainApplication.getInstance().setSize(getW(), newH); mState = STATE_SHOWING_REALTIME; mTimer.expireTimer(); RealtimeChart r; for (int i = 0; i < 2; i++) { stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexAt(i); if (pi != null && pi.id > 0) { r = new RealtimeChart(mContext.getTradeHistory(pi.id), this); r.setPosition(x + 1, y + 1); r.setSize(rW - 2, rH - 2); addControl(r); mRealtimes.addElement(r); x += rW; } } } }
virtual public void onTick() { try { processPostMessage(); if (mNextScreenID != -1) { System.Console.Out.WriteLine("=========mNextScreenID: " + mNextScreenID); if (mCurrentScreenID != -1) { mScreens[mCurrentScreenID].onDeactivate(); Controls.Remove(mScreens[mCurrentScreenID]); } mCurrentScreenID = mNextScreenID; mNextScreenID = -1; // remove current screen's toolbar mScreens[mCurrentScreenID].setSize(getDeviceW(), getDeviceH()); mScreens[mCurrentScreenID].onActivate(); Controls.Add(mScreens[mCurrentScreenID]); } if (mCurrentScreenID != -1) { mScreens[mCurrentScreenID].onTick(); } mIsExcutingTick = false; for (int i = 0; i < mTickControls.size(); i++) { xBaseControl c = (xBaseControl)mTickControls.elementAt(i); c.onTick(); } } catch (Exception e) { mIsExcutingTick = false; } }
public void removeControl(xBaseControl c) { Controls.Remove(c.getControl()); }
public void addControl(xBaseControl c) { Controls.Add(c.getControl()); }
public IndexControl(xIEventListener listener, int marketID, int w, int h) : base(listener) { mMarketID = marketID; mContext = Context.getInstance(); setSize(w, h); //setBackgroundColor(0xffff0000); mTab = new xTabControl(); addControl(mTab); mTab.setSize(w, h); TabControl tc = (TabControl)mTab.getControl(); tc.Selected += new TabControlEventHandler(tabControlSelected); int y = 0; for (int i = 0; i < TAB_TITLE.Length; i++) { xTabPage page = new xTabPage(TAB_TITLE[i]); mTab.addPage(page); if (i == 0) { stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexOfMarket(marketID); TradeHistory trade = mContext.getTradeHistory(pi.id); // realtime RealtimeChart rc = new RealtimeChart(trade, this); h = getH() - y; rc.setPosition(0, y); rc.setSize(w, h); page.addControl(rc); mRealtimeChart = rc; mCurrentChart = mRealtimeChart; } } int currentTab = mContext.getMarketControlTab(mMarketID); if (currentTab < 0 || currentTab >= TAB_INDEX.Length) { currentTab = 0; } if (currentTab != -1) { ((TabControl)mTab.getControl()).SelectedIndex = currentTab; onPageSelected(currentTab); } /* * // Do thi phien * * int[] ids = {ID_ONLINE_CHART, ID_MONEY_CHART, ID_VOLUMN_CHART, ID_HIS_CHART}; * int x = 0; * int y = 0; * int bw = (w / 4) - 2; * for (int i = 0; i < text.Length; i++) * { * bt = xButton.createStandardButton(ids[i], this, text[i], bw); * bt.setPosition(x, 0); * * addControl(bt); * x = bt.getRight() + 2; * y = bt.getBottom() + 4; * } */ }
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; } }
public void unregisterTick(xBaseControl c) { mTickControls.removeElement(c); }