Working MultipleChoiceValueEditor for checklist style

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@228 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-03-22 15:36:07 +00:00
parent 21781a559a
commit f5de36057c
7 changed files with 67 additions and 17 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ void MultipleChoiceValueViewer::draw(RotatedDC& dc) {
}
void MultipleChoiceValueViewer::drawChoice(RotatedDC& dc, RealPoint& pos, const String& choice, bool active) {
RealSize size;
RealSize size; size.height = item_height;
if (nativeLook() && (style().render_style & RENDER_CHECKLIST)) {
wxRect rect = dc.tr(RealRect(pos + RealSize(1,1), RealSize(12,12)));
draw_checkbox(nullptr, dc.getDC(), rect, active); // TODO
@@ -60,7 +60,7 @@ void MultipleChoiceValueViewer::drawChoice(RotatedDC& dc, RealPoint& pos, const
}
if (style().render_style & RENDER_TEXT) {
// draw text
String text = tr(*viewer.stylesheet, choice, capitalize(choice));
String text = tr(*viewer.stylesheet, choice, capitalize_sentence(choice));
RealSize text_size = dc.GetTextExtent(text);
dc.DrawText(text, align_in_rect(ALIGN_MIDDLE_LEFT, text_size,
RealRect(pos + RealSize(size.width + 1, 0), RealSize(0,size.height))));
+3 -1
View File
@@ -18,9 +18,11 @@
/// Viewer that displays a multiple choice value
class MultipleChoiceValueViewer : public ValueViewer {
public:
DECLARE_VALUE_VIEWER(MultipleChoice) : ValueViewer(parent,style) {}
DECLARE_VALUE_VIEWER(MultipleChoice) : ValueViewer(parent,style), item_height(0) {}
virtual void draw(RotatedDC& dc);
protected:
double item_height; ///< Height of a single item, or 0 if non uniform
private:
void drawChoice(RotatedDC& dc, RealPoint& pos, const String& choice, bool active = true);
};