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

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.7 ! root       31:        WXTextPanel(wxWindow *parent, const wxSize& size = wxDefaultSize,
        !            32:                long style = wxTAB_TRAVERSAL);
1.1.1.3   root       33:        virtual ~WXTextPanel() override;
1.1       root       34: 
1.1.1.7 ! root       35:        // フォント変更通知
        !            36:        virtual void FontChanged();
1.1       root       37: 
1.1.1.7 ! root       38:        int GetFontWidth() const { return font_width; }
        !            39:        int GetFontHeight() const { return font_height; }
1.1       root       40: 
1.1.1.7 ! root       41:  protected:
1.1       root       42:        // テキスト色を指定
1.1.1.5   root       43:        void ResetTextColor();
1.1.1.7 ! root       44:        void SetTextColor(Color fg, Color bg);
        !            45:        void SetTextForeColor(Color fg) { palette[FG] = fg; }
        !            46:        void SetTextBackColor(Color bg) { palette[BG] = bg; }
1.1.1.5   root       47: 
1.1       root       48:        // テキスト色を取得
1.1.1.7 ! root       49:        Color GetTextForeColor() const { return palette[FG]; }
        !            50:        Color GetTextBackColor() const { return palette[BG]; }
1.1       root       51: 
                     52:        // Shift_JIS (正確には CP932) 文字列を描画する。
1.1.1.7 ! root       53:        void DrawStringSJIS(Color c, int px, int py, const char *sjis,
        !            54:                uint attr = TA::Normal);
        !            55:        void DrawStringSJIS(int px, int py, const char *sjis,
1.1       root       56:                uint attr = TA::Normal);
                     57: 
1.1.1.5   root       58:        // 半角1文字を描画
1.1.1.7 ! root       59:        void DrawChar1(int px, int py, uint code, uint attr = TA::Normal);
1.1.1.5   root       60:        // 全角1文字を描画
1.1.1.7 ! root       61:        void DrawChar2(int px, int py, uint code, uint attr = TA::Normal);
        !            62: 
        !            63:        // フォントサイズ
        !            64:        int font_width {};
        !            65:        int font_height {};
1.1       root       66: 
                     67:        // 色
1.1.1.7 ! root       68:        Color palette[2] {};
1.1       root       69: };

unix.superglobalmegacorp.com

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