Exemple #1
0
void eos::ImageViewer::OnPaint()
{
    ax::GC gc;
    ax::Rect rect(GetDrawingRect());
    
    gc.SetColor(ax::Color(0.8, 0.8, 0.8));
    gc.DrawRectangle(rect);
}
Exemple #2
0
	void OnPaint()
	{
		ax::GC gc;
		ax::Rect rect(GetDrawingRect());

		gc.SetColor(ax::Color(1.0, 0.2));
		gc.DrawRectangle(ax::Rect(0, 0, rect.size.x, rect.size.y));

		gc.SetColor(ax::Color(0.05, 0.6));
		gc.DrawRectangle(ax::Rect(0, 0, rect.size.x, rect.size.y));
	}
Exemple #3
0
	void OnPaint()
	{
		ax::GC gc;
		ax::Rect rect(GetDrawingRect());

		gc.SetColor(ax::Color(0.96));
		gc.DrawRectangle(rect);

		gc.SetColor(ax::Color(0.4));
		gc.DrawRectangleContour(rect);
	}
/* ----------------------------------------------------------------
   現在のページを描画する
---------------------------------------------------------------- */
void VnOneProgDataMenu::Draw() {
  // 半透明枠の復元
  mrDirector.GetImage(1).Copy(mrDirector.GetImage(0), 38, 50, 564, 420, 38, 50);

  // カーソルを描画
//   mPages[mPage]->mPageClickable.Draw();

  // ページ番号を描画
  string now_page(VnKconv::Number2ZenKakuAll(mPage + 1, 1));
  string max_page(VnKconv::Number2ZenKakuAll(NUM_PAGE,  1));

  mrDirector.DrawString(PAGENUM_LEFT, PAGENUM_BOTTOM, reinterpret_cast<const u_int8_t *>(now_page.c_str()), 2, 0xffffffff);
  mrDirector.DrawString(PAGENUM_LEFT + 48, PAGENUM_BOTTOM, reinterpret_cast<const u_int8_t *>(max_page.c_str()), 2, 0xffffffff);

  // 各メニューを描画
  mPages[mPage]->mDataClickable.Draw();

  // 描画領域の通知
  mrDirector.UpdateWindow(GetDrawingRect());

}
Exemple #5
0
void eos::TextEditor::OnPaint()
{
    ax::GC gc;
    ax::Rect rect(GetDrawingRect());
    
    gc.SetColor(_info.bg_color);
    gc.DrawRectangle(ax::Rect(0, 0, rect.size.x, rect.size.y));
    
    // Draw line number background.
    gc.SetColor(_info.line_number_bg_color);
    gc.DrawRectangle(ax::Rect(0, 0, 25, rect.size.y));
    
    ax::Point num_pos(4, 2);
    
    gc.SetColor(_info.line_number_color);
    
    // Draw line number.
    for(int i = 0; i < _n_line_shown; i++)
    {
        int num = i + _file_start_index;
        std::string num_str = std::to_string(num);
        
        if(num < 10)
        {
            num_str = "  " + num_str;
        }
        else if(num < 100)
        {
            num_str = " " + num_str;
        }

        gc.DrawString(_line_num_font, num_str, num_pos);
        
        num_pos += ax::Point(0, 15);
    }
    
    
    
    
    // Text initial position.
    //ax::Point line_pos(4, 0);
    ax::Point line_pos(25 + 4, 0);
    
    _next_pos_data.clear();
    
    const ax::StringVector& data = _logic.GetFileData();
    
    // Set text color.
    gc.SetColor(_info.text_color);
    
    // Draw text.
    for(int i = 0, k = _file_start_index;
        k < data.size() && i < _n_line_shown; i++, k++)
    {
        const std::string& text = data[k];
        
        std::vector<int> next_vec(text.size() + 1);
        
        // Draw string.
        if(_font)
        {
            int x = line_pos.x;
            
            next_vec[0] = x;
//
            //----------------------------------------
//            ax::StringVector words = ax::Utils::String::Split(text, " ");
//            
//            int index = 0;
//            
//            for(auto& w : words)
//            {
//                std::string clean_word = RemoveSpecialChar(w);
//                
//                ax::Color word_color = _info.text_color;
//                
//                if(_key_words_cpp.find(clean_word) != _key_words_cpp.end())
//                {
//                    word_color = ax::Color(0.6627451, 0.05098039, 0.5686275);
//                }
//
//                for (int i = 0; i < w.size(); i++)
//                {
//                    gc.SetColor(word_color);
//                    
//                    if(text[index] == ' ')
//                    {
//                        i--;
//                        _font.SetChar(' ');
//                    }
//                    else
//                    {
//                        _font.SetChar(w[i]);
//                        
//                        if(is_special(w[i]))
//                        {
//                            gc.SetColor(_info.text_color);
//                        }
//                        else if(std::isdigit(w[i]))
//                        {
//                            gc.SetColor(ax::Color(0.0, 0.0, 1.0));
//                        }
//                    }
//                    
//                    ax::Point d = _font.GetDelta();
//                    
//                    ax::Point txtPos(x + d.x,
//                                     line_pos.y - d.y + _font.GetFontSize());
//                    
//                    ax::Rect txtRect(txtPos, _font.GetSize());
//                    gc.DrawTexture(_font.GetTexture(), txtRect);
//                    
//                    x += _font.GetNextPosition();
//                    
//                    next_vec[index + 1] = x;
//                    
//                    index++;
//                    
//                }
//            }
//            
//            _font.SetChar(' ');
//            ax::Point d = _font.GetDelta();
//            
//            while(index < text.size())
//            {
//                ax::Point txtPos(x + d.x,
//                                 line_pos.y - d.y + _font.GetFontSize());
//                ax::Rect txtRect(txtPos, _font.GetSize());
//                gc.DrawTexture(_font.GetTexture(), txtRect);
//                x += _font.GetNextPosition();
//                next_vec[index + 1] = x;
//                index++;
//            }
            //------------------------
        
            
            for (int i = 0; i < text.size(); i++)
            {
                _font.SetChar(text[i]);
                ax::Point d = _font.GetDelta();
                
                ax::Point txtPos(x + d.x,
                                 line_pos.y - d.y + _font.GetFontSize());
                
                ax::Rect txtRect(txtPos, _font.GetSize());
                gc.DrawTexture(_font.GetTexture(), txtRect);
                
                x += _font.GetNextPosition();
                
                next_vec[i + 1] = x;
            }
        }
        
        _next_pos_data.push_back(next_vec);
        line_pos += ax::Point(0, 15);
    }
    
    // Line cursor.
    ax::Point cursor_index = FileCursorPosToNextPosIndex();
    
    if(cursor_index.x != -1 && cursor_index.y != -1)
    {
        ax::Print("Draw cursor");
        int x = _next_pos_data[cursor_index.y][cursor_index.x];
        int y = cursor_index.y * _line_height;
        
//        gc.SetColor(_info.cursor_color);
        gc.SetColor(ax::Color(1.0, 0.0, 0.0));
        gc.DrawLine(ax::Point(x, y), ax::Point(x, y + _line_height));
    }
}