Annotation of nono/wx/wxtextpanel.h, revision 1.1

1.1     ! root        1: //
        !             2: // nono
        !             3: // Copyright (C) 2019 [email protected]
        !             4: //
        !             5: 
        !             6: #pragma once
        !             7: 
        !             8: #include <mutex>
        !             9: 
        !            10: //
        !            11: // テキストフォントを持つ管理するクラス
        !            12: //
        !            13: // wxPanel
        !            14: //  ↓
        !            15: // WXTextPanel  テキストフォントを管理するクラス
        !            16: //  ↓
        !            17: // WXTextScreen テキストフォントを使ったテキストスクリーン
        !            18: //
        !            19: 
        !            20: class WXTextPanel : public wxPanel
        !            21: {
        !            22:        typedef wxPanel inherited;
        !            23:  public:
        !            24:        WXTextPanel(wxWindow *parent);
        !            25:        virtual ~WXTextPanel();
        !            26: 
        !            27:        // フォントサイズ(指定値)
        !            28:        // この値を元に各コントロールに指示を出す
        !            29:        static fontsize_t global_fontsize;
        !            30: 
        !            31:  protected:
        !            32:        // このコントロールの現在のフォントサイズ
        !            33:        // (一瞬の過渡期以外は基本的に global_fontsize と同じ値のはず)
        !            34:        fontsize_t fontsize = FONT_NONE;
        !            35: 
        !            36:        // フォントの幅と高さ(ピクセル)
        !            37:        int font_width = 0;
        !            38:        int font_height = 0;
        !            39: 
        !            40:        // フォント関連の内部情報を更新する
        !            41:        void UpdateFont(fontsize_t fontsize);
        !            42: 
        !            43:        // グリフを切り替える。
        !            44:        // 0x5c は false: 円記号                    true: バックスラッシュ
        !            45:        // 0x7c は false: パイプ記号              true: パイプ記号(破線)
        !            46:        // 0x7e は false: オーバーライン        true: チルダ
        !            47:        void SetGlyph5C(bool value) { glyph_5c = value; }
        !            48:        void SetGlyph7C(bool value) { glyph_7c = value; }
        !            49:        void SetGlyph7E(bool value) { glyph_7e = value; }
        !            50: 
        !            51:        // テキスト色を指定
        !            52:        void SetTextColor(const wxColour& fg, const wxColour& bg,
        !            53:                const wxColour& disable);
        !            54:        void SetTextForeColor(const wxColour& fg) { text_fgcolor = fg; }
        !            55:        void SetTextBackColor(const wxColour& bg) { text_bgcolor = bg; }
        !            56:        void SetTextDisableColor(const wxColour& disable) {
        !            57:                text_disable_color = disable;
        !            58:        }
        !            59:        // テキスト色を取得
        !            60:        const wxColour& GetTextForeColor() const { return text_fgcolor; }
        !            61:        const wxColour& GetTextBackColor() const { return text_bgcolor; }
        !            62:        const wxColour& GetTextDisableColor() const { return text_disable_color; }
        !            63: 
        !            64:        // Shift_JIS (正確には CP932) 文字列を描画する。
        !            65:        void DrawStringSJIS(wxDC&, int px, int py, const char *sjis,
        !            66:                uint attr = TA::Normal);
        !            67: 
        !            68:        // ASCII 1文字を描画
        !            69:        void DrawChar1(wxDC&, int px, int py, uint code, uint attr);
        !            70:        // 漢字1文字を描画
        !            71:        void DrawChar2(wxDC&, int px, int py, uint code, uint attr);
        !            72: 
        !            73:  private:
        !            74:        // 指定の文字ビットマップを描画
        !            75:        void DrawBitmap(wxDC&, int px, int py, const wxBitmap& bitmap, uint attr);
        !            76:        // 漢字ビットマップを生成
        !            77:        wxBitmap *KanjiBitmap(uint16, uint attr);
        !            78: 
        !            79:        static void AllocFont(fontsize_t fontsize);
        !            80:        static void FreeFont(fontsize_t fontsize);
        !            81: 
        !            82:        // 現在のフォントでのフォントデータ
        !            83:        wxBitmap **ascii_glyph = NULL;
        !            84:        wxBitmap **bold_glyph = NULL;
        !            85: 
        !            86:        // 現在のグリフ
        !            87:        bool glyph_5c = false;
        !            88:        bool glyph_7c = false;
        !            89:        bool glyph_7e = false;
        !            90: 
        !            91:        static std::mutex global_font_mutex;
        !            92:        // 以下の3つを書き換える時は global_font_mutex を取ること
        !            93:        static u_int font_refcnt[FONT_MAX];
        !            94:        static wxBitmap *ascii_glyph_table[FONT_MAX][0x83];
        !            95:        static wxBitmap *bold_glyph_table[FONT_MAX][0x83];
        !            96: 
        !            97:        // 色
        !            98:        wxColour text_fgcolor;                  // 前景色
        !            99:        wxColour text_bgcolor;                  // 背景色
        !           100:        wxColour text_disable_color;    // Disable 属性時の前景色
        !           101: };
        !           102: 
        !           103: // 12ドット全角フォント
        !           104: extern uint8 builtin_kanji12[];

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.