|
|
1.1 root 1: //
2: // nono
1.1.1.2 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: //
1.1.1.7 root 8: // テキストフォントを描画するパネル
1.1 root 9: //
1.1.1.7 root 10:
1.1 root 11: // wxPanel
12: // ↓
1.1.1.7 root 13: // WXTextPanel テキストフォントを描画するパネル
1.1 root 14: // ↓
1.1.1.3 root 15: // WXTextScreen テキストスクリーンを表示するパネル
1.1 root 16:
1.1.1.7 root 17: #pragma once
18:
19: #include "wxbitmappanel.h"
20: #include "textscreen.h"
21:
22: class WXTextPanel : public WXBitmapPanel
1.1 root 23: {
1.1.1.7 root 24: using inherited = WXBitmapPanel;
25:
26: // パレット番号
27: static const int BG = 0;
28: static const int FG = 1;
29:
1.1 root 30: public:
1.1.1.8 root 31: WXTextPanel(wxWindow *parent, wxWindowID id = wxID_ANY,
32: const wxPoint& position = wxDefaultPosition,
33: const wxSize& size = wxDefaultSize,
1.1.1.7 root 34: long style = wxTAB_TRAVERSAL);
1.1.1.9 root 35: ~WXTextPanel() override;
1.1 root 36:
1.1.1.7 root 37: // フォント変更通知
38: virtual void FontChanged();
1.1 root 39:
1.1.1.7 root 40: int GetFontWidth() const { return font_width; }
41: int GetFontHeight() const { return font_height; }
1.1 root 42:
43: // テキスト色を指定
1.1.1.5 root 44: void ResetTextColor();
1.1.1.7 root 45: void SetTextColor(Color fg, Color bg);
46: void SetTextForeColor(Color fg) { palette[FG] = fg; }
47: void SetTextBackColor(Color bg) { palette[BG] = bg; }
1.1.1.5 root 48:
1.1 root 49: // テキスト色を取得
1.1.1.7 root 50: Color GetTextForeColor() const { return palette[FG]; }
51: Color GetTextBackColor() const { return palette[BG]; }
1.1 root 52:
53: // Shift_JIS (正確には CP932) 文字列を描画する。
1.1.1.7 root 54: void DrawStringSJIS(Color c, int px, int py, const char *sjis,
55: uint attr = TA::Normal);
56: void DrawStringSJIS(int px, int py, const char *sjis,
1.1 root 57: uint attr = TA::Normal);
58:
1.1.1.5 root 59: // 半角1文字を描画
1.1.1.7 root 60: void DrawChar1(int px, int py, uint code, uint attr = TA::Normal);
1.1.1.5 root 61: // 全角1文字を描画
1.1.1.7 root 62: void DrawChar2(int px, int py, uint code, uint attr = TA::Normal);
63:
1.1.1.10! root 64: protected:
1.1.1.7 root 65: // フォントサイズ
66: int font_width {};
67: int font_height {};
1.1 root 68:
69: // 色
1.1.1.7 root 70: Color palette[2] {};
1.1 root 71: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.