Esempio n. 1
0
void Single_Player::Create()
{
    QPixmap pixmap1("Black_Circle");
    QPixmap pixmap2("white-circle");
    QIcon Icon1(pixmap1);
    QIcon Icon2(pixmap2);
    for(int i=0;i<8;i++)
     for(int j=0;j<8;j++)
     {
         array[i][j]=0;
         button[i][j].setParent(this);
         button[i][j].resize(30,30);
         button[i][j].setStyleSheet("background-color:grey");
         button[i][j].move(30*j+10+30,30*i+10);
         button[i][j].show();
     }
    array[3][3]=White;
    array[3][4]=Black;
    array[4][4]=White;
    array[4][3]=Black;
    for(int i=0;i<8;i++)
     for(int j=0;j<8;j++)
     {
         if(array[i][j]==Black)
         {
             button[i][j].setIcon(Icon1);
             button[i][j].setIconSize(QSize(20,20));
         }
         if(array[i][j]==White)
        {
             button[i][j].setIcon(Icon2);
             button[i][j].setIconSize(QSize(20,20));
        }
     }
}
Esempio n. 2
0
//This function clears the buttons's background and set them again
void Single_Player::Modify()
{
    QPixmap pixmap("None");
    QIcon icon(pixmap);
    for(int i=0;i<8;i++)
     for(int j=0;j<8;j++)
     {
         if(array[i][j]!=White && array[i][j]!=Black)
         {
         button[i][j].setIcon(icon);
         button[i][j].setIconSize(QSize(20,20));
     }
 }
    if(turn==white)
        ui->label->setText("White");
    if(turn==black)
        ui->label->setText("Black");
      QPixmap pixmap1("Black_Circle");
      QPixmap pixmap2("white-circle");
      QIcon Icon1(pixmap1);
      QIcon Icon2(pixmap2);
      for(int i=0;i<=7;i++)
          for(int j=0;j<=7;j++)
          {
              if(array[i][j]==Black)
           {
                  button[i][j].setIcon(Icon1);
                  button[i][j].setIconSize(QSize(20,20));
              }
              if(array[i][j]==White)
              {
                  button[i][j].setIcon(Icon2);
                  button[i][j].setIconSize(QSize(20,20));
              }
          }
      }
Esempio n. 3
0
void frmMDFEditor::CreateControls()
{
    frmMDFEditor* itemFrame1 = this;

    wxMenuBar* menuBar = new wxMenuBar;
    wxMenu* itemMenu3 = new wxMenu;
    itemMenu3->Append( ID_MENUITEM_NEW, _( "Create New MDF File" ), wxEmptyString, wxITEM_NORMAL );
    itemMenu3->AppendSeparator();
    itemMenu3->Append( ID_MENUITEM_OPEN, _( "Open MDF file..." ), wxEmptyString, wxITEM_NORMAL );
    itemMenu3->Append( ID_MENUITEM_SAVE, _( "Save MDF File..." ), wxEmptyString, wxITEM_NORMAL );
    itemMenu3->AppendSeparator();
    itemMenu3->Append( ID_MENUITEM_DOWNLOAD, _( "Download MDF file..." ), wxEmptyString, wxITEM_NORMAL );
    itemMenu3->Append( ID_MENUITEM_UPLOAD, _( "Upload MDF file..." ), wxEmptyString, wxITEM_NORMAL );
    itemMenu3->AppendSeparator();
    itemMenu3->Append( ID_MENUITEM_EXIT, _( "Exit" ), wxEmptyString, wxITEM_NORMAL );
    menuBar->Append( itemMenu3, _( "File" ) );
    wxMenu* itemMenu13 = new wxMenu;
    itemMenu13->Append( ID_MENUITEM_ADD, _( "Add MDF Item..." ), wxEmptyString, wxITEM_NORMAL );
    itemMenu13->Append( ID_MENUITEM_REMOVE, _( "Remove MDF Item..." ), wxEmptyString, wxITEM_NORMAL );
    menuBar->Append( itemMenu13, _( "Edit" ) );
    itemFrame1->SetMenuBar( menuBar );

    wxPanel* itemPanel16 = new wxPanel;
    itemPanel16->Create( itemFrame1, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL );

    wxBoxSizer* itemBoxSizer17 = new wxBoxSizer( wxVERTICAL );
    itemPanel16->SetSizer( itemBoxSizer17 );

    wxToolBar* itemToolBar18 = new wxToolBar;
    itemToolBar18->Create( itemPanel16, ID_TOOLBAR3, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_HORIZONTAL );
    wxBitmap itemtool19Bitmap( itemFrame1->GetBitmapResource( wxT( "deffile.xpm" ) ) );
    wxBitmap itemtool19BitmapDisabled;
    itemToolBar18->AddTool( ID_TOOL_NEW, wxEmptyString, itemtool19Bitmap, itemtool19BitmapDisabled, wxITEM_NORMAL, _( "Create new MDF file" ), wxEmptyString );
    wxBitmap itemtool20Bitmap( itemFrame1->GetBitmapResource( wxT( "open.xpm" ) ) );
    wxBitmap itemtool20BitmapDisabled;
    itemToolBar18->AddTool( ID_TOOL_LOAD, wxEmptyString, itemtool20Bitmap, itemtool20BitmapDisabled, wxITEM_NORMAL, _( "Load MDF file" ), wxEmptyString );
    wxBitmap itemtool21Bitmap( itemFrame1->GetBitmapResource( wxT( "save.xpm" ) ) );
    wxBitmap itemtool21BitmapDisabled;
    itemToolBar18->AddTool( ID_TOOL_SAVE, wxEmptyString, itemtool21Bitmap, itemtool21BitmapDisabled, wxITEM_NORMAL, _( "Save MDF file" ), wxEmptyString );
    wxBitmap itemtool22Bitmap( itemFrame1->GetBitmapResource( wxT( "filesaveas.xpm" ) ) );
    wxBitmap itemtool22BitmapDisabled;
    itemToolBar18->AddTool( ID_TOOL_UPLOAD, wxEmptyString, itemtool22Bitmap, itemtool22BitmapDisabled, wxITEM_NORMAL, _( "Upload MDF file" ), wxEmptyString );
    wxBitmap itemtool23Bitmap( itemFrame1->GetBitmapResource( wxT( "redo.xpm" ) ) );
    wxBitmap itemtool23BitmapDisabled;
    itemToolBar18->AddTool( ID_TOOL_DOWNLOAD, wxEmptyString, itemtool23Bitmap, itemtool23BitmapDisabled, wxITEM_NORMAL, _( "Upload MDF file" ), wxEmptyString );
    itemToolBar18->AddSeparator();
    wxBitmap itemtool25Bitmap( itemFrame1->GetBitmapResource( wxT( "New1.xpm" ) ) );
    wxBitmap itemtool25BitmapDisabled;
    itemToolBar18->AddTool( ID_TOOL_ADD_ITEM, wxEmptyString, itemtool25Bitmap, itemtool25BitmapDisabled, wxITEM_NORMAL, _( "Add MDF item" ), wxEmptyString );
    wxBitmap itemtool26Bitmap( itemFrame1->GetBitmapResource( wxT( "delete.xpm" ) ) );
    wxBitmap itemtool26BitmapDisabled;
    itemToolBar18->AddTool( ID_TOOL_REMOVE_ITEM, wxEmptyString, itemtool26Bitmap, itemtool26BitmapDisabled, wxITEM_NORMAL, _( "Remove MDF item" ), wxEmptyString );
    itemToolBar18->Realize();
    itemBoxSizer17->Add( itemToolBar18, 0, wxGROW | wxALL, 5 );

    m_mdfTree = new wxTreeCtrl;
    m_mdfTree->Create( itemPanel16, ID_TREECTRL, wxDefaultPosition, wxSize( 400, 300 ), wxTR_HAS_BUTTONS | wxTR_FULL_ROW_HIGHLIGHT | wxTR_LINES_AT_ROOT | wxTR_ROW_LINES | wxTR_SINGLE );
    itemBoxSizer17->Add( m_mdfTree, 0, wxGROW | wxALL, 2 );

    m_htmlInfoWnd = new wxHtmlWindow;
    m_htmlInfoWnd->Create( itemPanel16, ID_HTMLWINDOW2, wxDefaultPosition, wxSize( 200, 150 ), wxHW_SCROLLBAR_AUTO | wxSUNKEN_BORDER | wxHSCROLL | wxVSCROLL );
    m_htmlInfoWnd->SetPage( _( "<html><h4>No data</h4></html>" ) );
    itemBoxSizer17->Add( m_htmlInfoWnd, 0, wxGROW | wxALL, 5 );

    // Connect events and objects
    m_mdfTree->Connect( ID_TREECTRL, wxEVT_LEFT_DOWN, wxMouseEventHandler( frmMDFEditor::OnLeftDown ), NULL, this );
    m_mdfTree->Connect( ID_TREECTRL, wxEVT_LEFT_DCLICK, wxMouseEventHandler( frmMDFEditor::OnLeftDClick ), NULL, this );

    wxImageList* itemImageList = new wxImageList( 16, 16, true, 5 );
    {
        wxIcon Icon0( Home_xpm );
        itemImageList->Add( Icon0 );
        wxIcon Icon1( Folder_Add_xpm );
        itemImageList->Add( Icon1 );
        wxIcon Icon2( Info_xpm );
        itemImageList->Add( Icon2 );
        wxIcon Icon3( copy_xpm );
        itemImageList->Add( Icon3 );
        wxIcon Icon4( copy_xpm );
        itemImageList->Add( Icon4 );
    }

    m_mdfTree->AssignImageList( itemImageList );
    addDefaultContent();
}