MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Render

Method Render

Source/DropdownList.cpp:156–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156void DropdownList::Render()
157{
158 ofPushStyle();
159
160 float w, h;
161 GetDimensions(w, h);
162
163 ofColor color, textColor;
164 IUIControl::GetColors(color, textColor);
165 float xOffset = 0;
166
167 if (mDisplayStyle == DropdownDisplayStyle::kNormal)
168 {
169 if (mDrawLabel)
170 {
171 DrawTextNormal(Name(), mX, mY + 12);
172 xOffset = mLabelSize;
173 }
174
175 DrawBeacon(mX + mWidth / 2 + xOffset, mY + mHeight / 2);
176
177 ofFill();
178 ofSetColor(0, 0, 0, gModuleDrawAlpha * .5f);
179 ofRect(mX + 1 + xOffset, mY + 1, w - xOffset, h);
180 ofSetColor(color);
181 ofRect(mX + xOffset, mY, w - xOffset, h);
182 ofNoFill();
183
184 ofSetColor(textColor);
185
186 ofPushMatrix();
187 ofClipWindow(mX, mY, w - (mDrawTriangle ? 12 : 0), h, true);
188 DrawTextNormal(GetDisplayValue(*mVar), mX + 2 + xOffset, mY + 12);
189 ofPopMatrix();
190 if (mDrawTriangle)
191 {
192 ofSetLineWidth(.5f);
193 ofTriangle(mX + w - 11, mY + 4, mX + w - 3, mY + 4, mX + w - 7, mY + 11);
194 }
195 }
196 else if (mDisplayStyle == DropdownDisplayStyle::kHamburger)
197 {
198 ofSetColor(textColor);
199 ofSetLineWidth(1.0f);
200 ofLine(mX + 6, mY + 4.5f, mX + 14, mY + 4.5f);
201 ofLine(mX + 6, mY + 7.5f, mX + 14, mY + 7.5f);
202 ofLine(mX + 6, mY + 10.5f, mX + 14, mY + 10.5f);
203 }
204
205 ofPopStyle();
206
207 DrawHover(mX + xOffset, mY, w - xOffset, h);
208
209 if (mLastScrolledTime + 300 > gTime && TheSynth->GetTopModalFocusItem() != &mModalList && !Push2Control::sDrawingPush2Display)
210 {
211 const float kCentering = 7;
212 float pw, ph;
213 GetPopupDimensions(pw, ph);

Callers

nothing calls this directly

Calls 15

ofPushStyleFunction · 0.85
DrawTextNormalFunction · 0.85
ofFillFunction · 0.85
ofSetColorFunction · 0.85
ofRectFunction · 0.85
ofNoFillFunction · 0.85
ofPushMatrixFunction · 0.85
ofClipWindowFunction · 0.85
ofPopMatrixFunction · 0.85
ofSetLineWidthFunction · 0.85
ofTriangleFunction · 0.85
ofLineFunction · 0.85

Tested by

no test coverage detected