void browserView::showCategories() { /*************** softkeys ********************/ int height = 30; Layout * softkey_layout = new Layout(0, scrHeight, scrWidth, height, NULL, 2, 1); Label * softLeft = new Label (0, 0, scrWidth / 2, height, softkey_layout); softLeft->setCaption ("select"); softLeft->setBackgroundColor (0); softLeft->setHorizontalAlignment (Label::HA_LEFT); setLabelPadding (softLeft); Label * softRight = new Label (0, 0, scrWidth/2, height, softkey_layout); softRight->setCaption ("exit"); softRight->setBackgroundColor (0); softRight->setHorizontalAlignment (Label::HA_RIGHT); setLabelPadding (softRight); this->getMain ()->add (softkey_layout); createLabel ("calculate", list_box); createLabel ("entertainment", list_box); createLabel ("games", list_box); createLabel ("news", list_box); createLabel ("productivity", list_box); createLabel ("search tools", list_box); createLabel ("social", list_box); createLabel ("sports", list_box); createLabel ("travel", list_box); createLabel ("utilities", list_box); createLabel ("weather", list_box); }
void browserView::showApplications(application *applications, int count) { int height = 30; Layout * softkey_layout = new Layout (0, scrHeight, scrWidth, height, NULL, 2, 1); Label * softLeft = new Label (0, 0, scrWidth / 2, height, softkey_layout); softLeft->setCaption ("select"); if (count == 0) { createInfoLabel ("", "No apps in this category", list_box); this->currentScreen = BROWSER_VIEW; softLeft->setCaption (""); } softLeft->setBackgroundColor (0); softLeft->setHorizontalAlignment (Label::HA_LEFT); setLabelPadding (softLeft); Label * softRight = new Label (0, 0, scrWidth/2, height, softkey_layout); softRight->setCaption ("back"); softRight->setBackgroundColor (0); softRight->setHorizontalAlignment (Label::HA_RIGHT); setLabelPadding (softRight); this->getMain ()->add (softkey_layout); int i; for(i = 0; i < count; i++){ //printf("%s\n", applications[i].name); createLabel (applications [i].name, list_box); } }
Label* createLabel(const char *str, int height) { Label *label; label = new Label(0,0, scrWidth-PADDING*2, height, NULL, str, 0, gFont); label->setSkin(gSkin); setLabelPadding(label); return label; }
Widget* createSoftKeyBar(int height, const char *left, const char *right) { Layout *layout = new Layout(0, 0, scrWidth, height, NULL, 2, 1); Label *label; label = new Label(0,0, scrWidth/2, height, NULL, left, 0, gFont); label->setHorizontalAlignment(Label::HA_LEFT); label->setDrawBackground(false); setLabelPadding(label); layout->add(label); label = new Label(0,0, scrWidth/2, height, NULL, right, 0, gFont); label->setDrawBackground(false); label->setHorizontalAlignment(Label::HA_RIGHT); setLabelPadding(label); layout->add(label); return layout; }
void InstrumentGrid::setLightCount(int count) { MessageManagerLock l; auto oldCount = instruments_.size(); if (count == oldCount) return; cache_.resize(3 * count); auto delta = labelStartsAtZero_ ? 0 : 1; instruments_.resize(count); for (auto i = oldCount; i < count; ++i) { auto inst = make_unique<InstrumentComponent>(); inst->setPaintingIsUnclipped(isUnclipped_); inst->setLabelPadding(labelPadding_.first, labelPadding_.second); inst->setLabel(String(uint32(i + delta))); addAndMakeVisible(inst.get()); instruments_[i] = std::move(inst); } layout(); }