void CObjectProperty::Clear ( void )
{
    if ( m_pEditItem )
    {
        m_pEditItem->OnEndEdit();
        m_pEditItem->Enable ( FALSE );
    }
    SetCurSel (  NULL,TRUE);

    int iGroupSize = m_pGroups.size ( );
    for ( int iGroup = iGroupSize; iGroup > 0; iGroup-- )
    {
        int iSubSize = m_pGroups [ iGroup - 1 ].pProperty->GetSubItemsCount ( );
        for ( int iControl = iSubSize; iControl > 0; iControl-- )
        {
            DeleteControl ( iGroup - 1, iControl - 1 );
        }
        DeleteGroup ( iGroup );
    }

    AdjustLayout ( );

    m_iGroupCount = 0;

    m_bModified = false;
    m_iGroup	= 0;
    m_iIndex	= 0;

    m_pGroups.clear ( );
}
Ejemplo n.º 2
0
void CMainFrame::CutControl()
{
	if (CWndControl::s_selection.GetSize() < 1
		|| !CWndControl::s_selection[0]
		|| CWndControl::s_selection[0]->GetType() == WTYPE_GUI_EDITOR_WND)
		return;

	CopyControl();
	DeleteControl();
}
Ejemplo n.º 3
0
void CMainFrame::DeleteWindow()
{
	QModelIndex index = ui.listWindows->currentIndex();
	if (index.isValid())
	{
		const QString windowIDStr = m_windowList->stringList().at(index.row());
		const int windowID = m_dataMng->GetWindowID(windowIDStr);
		if (windowID != -1)
		{
			CWndControl* ctrl = WndMng->GetControl(windowID);
			if (ctrl)
			{
				CWndControl::s_selection.RemoveAll();
				CWndControl::s_selection.Append(ctrl);
				DeleteControl();
			}
		}
	}
}
Ejemplo n.º 4
0
void menu(DATA P)
{
    int input;


    system("clear");//change to "cls" if your OS windows
    printf("\n\t JUDUL \n\n");
    printf("1. Insert data\n");
    printf("2. Update data\n");
    printf("3. Delete data\n");
    printf("4. Show data\n");
    printf("Other. Exit\n");
    printf("\n\nInput : ");scanf("%d",&input);

    switch(input)
    {
        case 1:P=InsertControl(P);menu(P);
        case 2:P=UpdateControl(P);menu(P);
        case 3:P=DeleteControl(P);menu(P);
        case 4:ShowTableControl(P);
        default:exit(EXIT_FAILURE);
    }
}
Ejemplo n.º 5
0
void GUI::Process()
{
		now_tick = GetTickCount() - prev_tick;

		for(std::vector<GUIcontrol*>::iterator it = controls.begin(); it != controls.end(); it++)
		{
			if((*it))
			{
				(*it)->Process();
				if((*it)->IWannaDie) DeleteControl(*it); // this totally sux, i expect memory leaks

				if(!(*it)->GetNext())
					if((*it)->GetNextName())
					{
						(*it)->SetNext(ItemByName((*it)->GetNextName()));

						if(!(*it)->GetNext())
						{
							char output[50];
							sprintf(output, "Error: could not set next for %s [NextName=%s]", (*it)->GetName(), (*it)->GetNextName());
							LogToFile(DEFAULT_GUI_LOG_NAME, output);
						}
					}
			}
		}

	for(std::vector<GUIMessage>::iterator it = guima.messages.begin(); it != guima.messages.end(); it++)
	{
		if((*it).a1 == MOUSE_LEFT_CLICKED)
		{
			GUIcontrol* ctrl;
			ctrl = ItemByGID((*it).from);
#ifdef _DEBUG_GUI
			string msg;
			msg = ctrl->GetName();
			msg += string(" pressed");		
			LogOnScreen(msg);
#endif
			switch(ctrl->GetAction())
			{
			case 0: break;
			case 1:
				{
					ctrl->OpenNext();
					break;
				}
			case 2:
				{
					// here should be StartGame
					break;
				}
			case 3:
				{
					ctrl->ExitProgram();
					break;
				}
			default: break;
			}

			switch(ctrl->GetGroup())
			{
			case gNo: break;
			case gDifficulty:
				{
					difficulty_pick = ctrl->GetData();
					break;
				}
			case gRace:
				{
					race_pick = ctrl->GetData();
					break;
				}
			case gSize:
				{
					size_pick = ctrl->GetData();
					break;
				}
			case gOpponents:
				{
					opponents_pick = ctrl->GetData();
					break;
				}
			default: break;
			}

		}
		(*it).solved = true;
	}

		for(int i = 0; i < guima.messagesCount; i++)
		{
			if(guima.messages[i].solved)
			{
				guima.messages.erase(guima.messages.begin() + i);
				guima.messagesCount--;
			}
		}

		if(GetTickCount() - prev_tick >= 1000)
		{
			prev_tick = GetTickCount();


			for(std::vector<QMessage>::iterator it = queue.begin(); it != queue.end(); it++)
			{
				it->time_remains--;

			}

			for(int i = 0; i < queueCount; i++)
			{
				if(queue[i].time_remains <= 0)
				{
					queue.erase(queue.begin() + i);
					queueCount--;
				}
			}
		}

}