--- nono/wx/wxtextpanel.h 2026/04/29 17:04:39 1.1.1.3 +++ nono/wx/wxtextpanel.h 2026/04/29 17:04:53 1.1.1.5 @@ -24,6 +24,7 @@ class WXTextPanel : public wxPanel using inherited = wxPanel; public: WXTextPanel(wxWindow *parent); + WXTextPanel(wxWindow *parent, long style); virtual ~WXTextPanel() override; // フォント種別(指定値) @@ -63,34 +64,27 @@ class WXTextPanel : public wxPanel void SetGlyph7E(bool value) { glyph_7e = value; } // テキスト色を指定 - void SetTextColor(const wxColour& fg, const wxColour& bg, - const wxColour& disable); + void ResetTextColor(); + void SetTextColor(const wxColour& fg, const wxColour& bg); void SetTextForeColor(const wxColour& fg) { text_fgcolor = fg; } void SetTextBackColor(const wxColour& bg) { text_bgcolor = bg; } - void SetTextDisableColor(const wxColour& disable) { - text_disable_color = disable; - } + // テキスト色を取得 const wxColour& GetTextForeColor() const { return text_fgcolor; } const wxColour& GetTextBackColor() const { return text_bgcolor; } - const wxColour& GetTextDisableColor() const { return text_disable_color; } // Shift_JIS (正確には CP932) 文字列を描画する。 void DrawStringSJIS(wxDC&, int px, int py, const char *sjis, uint attr = TA::Normal); - // ASCII 1文字を描画 + // 半角1文字を描画 void DrawChar1(wxDC&, int px, int py, uint code, uint attr); - // 半角カナ1文字を描画 - void DrawCharKana(wxDC&, int px, int py, uint code, uint attr); - // 漢字1文字を描画 + // 全角1文字を描画 void DrawChar2(wxDC&, int px, int py, uint code, uint attr); + // 指定の文字ビットマップを描画 + void DrawBitmap(wxDC&, int px, int py, const wxBitmap& bitmap); private: - // 指定の文字ビットマップを描画 - void DrawBitmap(wxDC&, int px, int py, const wxBitmap& bitmap, uint attr); - // 半角カナビットマップを生成 - wxBitmap *KanaBitmap(uint16, uint attr); // 漢字ビットマップを生成 wxBitmap *KanjiBitmap(uint16, uint attr); @@ -98,22 +92,22 @@ class WXTextPanel : public wxPanel static void FreeFont(FontId fontid); // 現在のフォントでのフォントデータ - wxBitmap **ascii_glyph = NULL; - wxBitmap **bold_glyph = NULL; + wxBitmap **ascii_glyph {}; + wxBitmap **bold_glyph {}; // 現在のグリフ - bool glyph_5c = false; - bool glyph_7c = false; - bool glyph_7e = false; + bool glyph_5c {}; + bool glyph_7c {}; + bool glyph_7e {}; static std::mutex global_font_mutex; // 以下の3つを書き換える時は global_font_mutex を取ること static u_int font_refcnt[FontId::Max]; - static wxBitmap *ascii_glyph_table[FontId::Max][0x83]; - static wxBitmap *bold_glyph_table[FontId::Max][0x83]; + // 半角文字キャッシュ + static wxBitmap *ascii_glyph_table[FontId::Max][256]; + static wxBitmap *bold_glyph_table[FontId::Max][256]; // 色 - wxColour text_fgcolor; // 前景色 - wxColour text_bgcolor; // 背景色 - wxColour text_disable_color; // Disable 属性時の前景色 + wxColour text_fgcolor {}; // 前景色 + wxColour text_bgcolor {}; // 背景色 };