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

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: 
1.1.1.7   root       43:  protected:
1.1       root       44:        // テキスト色を指定
1.1.1.5   root       45:        void ResetTextColor();
1.1.1.7   root       46:        void SetTextColor(Color fg, Color bg);
                     47:        void SetTextForeColor(Color fg) { palette[FG] = fg; }
                     48:        void SetTextBackColor(Color bg) { palette[BG] = bg; }
1.1.1.5   root       49: 
1.1       root       50:        // テキスト色を取得
1.1.1.7   root       51:        Color GetTextForeColor() const { return palette[FG]; }
                     52:        Color GetTextBackColor() const { return palette[BG]; }
1.1       root       53: 
                     54:        // Shift_JIS (正確には CP932) 文字列を描画する。
1.1.1.7   root       55:        void DrawStringSJIS(Color c, int px, int py, const char *sjis,
                     56:                uint attr = TA::Normal);
                     57:        void DrawStringSJIS(int px, int py, const char *sjis,
1.1       root       58:                uint attr = TA::Normal);
                     59: 
1.1.1.5   root       60:        // 半角1文字を描画
1.1.1.7   root       61:        void DrawChar1(int px, int py, uint code, uint attr = TA::Normal);
1.1.1.5   root       62:        // 全角1文字を描画
1.1.1.7   root       63:        void DrawChar2(int px, int py, uint code, uint attr = TA::Normal);
                     64: 
                     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: };

unix.superglobalmegacorp.com

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