void WriteCPlusPlusClass::writeInclude(QFile &file, JsonClass newClass) { //QFile file("/tmp/test.h"); file.write("#include\"../../JsonClassInterface.h\""); file.write("\n"); for (int i = 0; i < newClass.fields.size(); i++) { if (!defaultType.contains(newClass.fields.at(i).type)) { if (newClass.fields.at(i).type == "string") { file.write(QString("#include<QString>\n").toStdString().c_str()); // write QString } else { // write name type } } } file.write("\n"); file.write(QString("class " + newClass.name +":public JsonClassInterface {\n").toStdString().c_str()); file.write("private:\n"); for (int i = 0; i < newClass.fields.size(); i++) { if (newClass.fields.at(i).type == "integer") { file.write(QString("\tint " + newClass.fields.at(i).name + ";\n").toStdString().c_str()); } else if (newClass.fields.at(i).type == "string") { file.write(QString("\tQString " + newClass.fields.at(i).name + ";\n").toStdString().c_str()); // write QString } else { file.write(QString("\t" + newClass.fields.at(i).type + " " + newClass.fields.at(i).name + ";\n").toStdString().c_str()); } } // write methods file.write("\npublic:\n"); file.write(QString(QString("\t") + newClass.name +"();\n").toStdString().c_str()); for (int i = 0; i < newClass.fields.size(); i++) { if (newClass.fields.at(i).type == "integer") { file.write(QString("\tint " + createGet(newClass.fields.at(i)) + ";\n").toStdString().c_str()); } else if (newClass.fields.at(i).type == "string") { file.write(QString("\tQString " + createGet(newClass.fields.at(i)) + ";\n").toStdString().c_str()); // write QString } else { file.write(QString("\t" + newClass.fields.at(i).type + " " + createGet(newClass.fields.at(i)) + ";\n").toStdString().c_str()); } } for (int i = 0; i < newClass.fields.size(); i++) { if (newClass.fields.at(i).type == "integer") { file.write(QString("\t" + createSet(newClass.fields.at(i), "int") + ";\n").toStdString().c_str()); } else if (newClass.fields.at(i).type == "string") { file.write(QString("\t" + createSet(newClass.fields.at(i), "QString") + ";\n").toStdString().c_str()); // write QString } else { file.write(QString("\t" + createSet(newClass.fields.at(i), newClass.fields.at(i).type) + ";\n").toStdString().c_str()); } } file.write(QString("\tvoid read(const QJsonObject &json);\n").toStdString().c_str()); file.write(QString("\tvoid write(QJsonObject &json) const;\n").toStdString().c_str()); file.write("};\n"); }
bool FontInfoWindow::create(Point2I pos, Point2I size) { if (!createMDIChild(NULL, "Font Info", WS_VISIBLE | WS_CAPTION, pos, size, parent, 0)) return(false); #define CBRB_COLUMN 220 #define ITEM_COLUMN 100 #define ITEM_WIDTH 90 CreateWindow("STATIC", "Count:", WS_CHILD | SS_SIMPLE | WS_VISIBLE, 10, 5, ITEM_WIDTH, 20, hWnd, (HMENU)0, hInstance, NULL); CreateWindow("STATIC", "Widht:", WS_CHILD | SS_SIMPLE | WS_VISIBLE, 10, 25, ITEM_WIDTH, 20, hWnd, (HMENU)0, hInstance, NULL); CreateWindow("STATIC", "Height:", WS_CHILD | SS_SIMPLE | WS_VISIBLE, 10, 45, ITEM_WIDTH, 20, hWnd, (HMENU)0, hInstance, NULL); CreateWindow("STATIC", "Baseline:", WS_CHILD | SS_SIMPLE | WS_VISIBLE, 10, 65, ITEM_WIDTH, 20, hWnd, (HMENU)0, hInstance, NULL); CreateWindow("STATIC", "Palette:", WS_CHILD | SS_SIMPLE | WS_VISIBLE, 10, 85, ITEM_WIDTH, 20, hWnd, (HMENU)0, hInstance, NULL); CreateWindow("STATIC", "Foreground:", WS_CHILD | SS_SIMPLE | WS_VISIBLE, 10, 105, ITEM_WIDTH, 20, hWnd, (HMENU)0, hInstance, NULL); CreateWindow("STATIC", "Background:", WS_CHILD | SS_SIMPLE | WS_VISIBLE, 10, 126, ITEM_WIDTH, 20, hWnd, (HMENU)0, hInstance, NULL); CreateWindow("STATIC", "Spacing:", WS_CHILD | SS_SIMPLE | WS_VISIBLE, 10, 147, ITEM_WIDTH, 20, hWnd, (HMENU)0, hInstance, NULL); hWndFontCt = CreateWindow("STATIC", "", WS_CHILD | SS_SIMPLE | WS_VISIBLE, ITEM_COLUMN, 5, 70, 20, hWnd, (HMENU)0, hInstance, NULL); hWndFontWidth = CreateWindow("STATIC", "", WS_CHILD | SS_SIMPLE | WS_VISIBLE, ITEM_COLUMN, 25, 70, 20, hWnd, (HMENU)0, hInstance, NULL); hWndFontHeight = CreateWindow("STATIC", "", WS_CHILD | SS_SIMPLE | WS_VISIBLE, ITEM_COLUMN, 45, 70, 20, hWnd, (HMENU)0, hInstance, NULL); hWndFontBaseline = CreateWindow("STATIC", "", WS_CHILD | SS_SIMPLE | WS_VISIBLE, ITEM_COLUMN, 65, 70, 20, hWnd, (HMENU)0, hInstance, NULL); hWndFontForeground = createGet(ID_GET_FOREGROUND, ITEM_COLUMN, 105, 70, 20); hWndFontForegroundSet = CreateWindow("Button", "Set", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, ITEM_COLUMN + 75, 105, 30, 20, hWnd, (HMENU)ID_SET_FOREGROUND, hInstance, NULL); hWndFontBackground = createGet(ID_GET_BACKGROUND, ITEM_COLUMN, 126, 70, 20); hWndFontBackgroundSet = CreateWindow("Button", "Set", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, ITEM_COLUMN + 75, 126, 30, 20, hWnd, (HMENU)ID_SET_BACKGROUND, hInstance, NULL); hWndFontSpacing = createGet(ID_GET_SPACING, ITEM_COLUMN, 147, 70, 20); hWndFontSpacingSet = CreateWindow("Button", "Set", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, ITEM_COLUMN + 75, 147, 30, 20, hWnd, (HMENU)ID_SET_SPACING, hInstance, NULL); hWndPaletteIncl = CreateWindow("STATIC", "", WS_CHILD | SS_SIMPLE | WS_VISIBLE, ITEM_COLUMN, 85, 70, 20, hWnd, (HMENU)0, hInstance, NULL); hWndTransparent = createCheckBox(ID_CB_TRANSPARENT, CBRB_COLUMN, 5, "Transparent"); hWndTranslucent = createCheckBox(ID_CB_TRANSLUCENT, CBRB_COLUMN, 25, "Translucent"); hWndMono = createCheckBox(ID_CB_MONO, CBRB_COLUMN, 45, "Mono"); hWndUnderlined = createCheckBox(ID_CB_UNDERLINED, CBRB_COLUMN, 65, "Underlined"); hWndSavePalette = createCheckBox(ID_CB_SAVEPALETTE, CBRB_COLUMN, 85, "Save Palette"); hWndProportional = CreateWindow("BUTTON", "Proportional", WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | WS_GROUP | BS_TEXT, CBRB_COLUMN, 115, 120, 20, hWnd, (HMENU)ID_RB_PROPORTIONAL, hInstance, NULL); hWndFixed = CreateWindow("BUTTON", "Fixed", WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_TEXT, CBRB_COLUMN, 135, 120, 20, hWnd, (HMENU)ID_RB_FIXED, hInstance, NULL); return(true); }