예제 #1
0
파일: radiobox.cpp 프로젝트: EdgarTx/wx
// Find string for position
wxString wxRadioBox::GetString(unsigned int item) const
{
    wxRadioButton *btn = GetRadioButton(item);
    if(btn)
        return btn->GetLabel();
    return wxEmptyString;
}
예제 #2
0
파일: radiobox.cpp 프로젝트: EdgarTx/wx
// Enable a specific button
bool wxRadioBox::Enable(unsigned int item, bool enable)
{
    wxRadioButton *btn = GetRadioButton(item);
    if(btn)
        return btn->Enable(enable);
    return false;
}
// Save the current dialog box information to permanent storage
void	CDataSettingsDialog::SaveDataSettings( void )
{
	if( UpdateData( TRUE ) == FALSE) return;

	if( m_CurDataSet < 0 ) m_CurDataSet = 0;
	if( m_CurDataSet > m_pChart->GetDataSetCount() - 1 ) m_CurDataSet = m_pChart->GetDataSetCount() - 1;

	switch( m_MarkerShape )
	{
	case 0: tempChart.m_MarkerType[m_CurDataSet] = kXYMarkerNone; break;
	case 1: tempChart.m_MarkerType[m_CurDataSet] = kXYMarkerSquare; break;
	case 2: tempChart.m_MarkerType[m_CurDataSet] = kXYMarkerTriangle; break;
	case 3: tempChart.m_MarkerType[m_CurDataSet] = kXYMarkerCircle; break;
	case 4: tempChart.m_MarkerType[m_CurDataSet] = kXYMarkerX; break;
	}

	switch( m_ChartType )
	{
	case 0: tempChart.m_ChartType[m_CurDataSet] = kXYChartPlain; break;
	case 1: tempChart.m_ChartType[m_CurDataSet] = kXYChartConnect; break;
	case 2: tempChart.m_ChartType[m_CurDataSet] = kXYChartHistogram; break;
	}

	tempChart.m_PlotColor[m_CurDataSet] = m_Color;

	tempChart.m_DataTitle[m_CurDataSet] = m_Title;

	tempChart.m_MarkerSize[m_CurDataSet] = 10 * m_MarkerSize;

	tempChart.m_MarkerFill[m_CurDataSet] = m_MarkerFill;

	tempChart.m_DataLineSize[m_CurDataSet] = m_DataLineSize;

	tempChart.m_DataLineStyle[m_CurDataSet] = m_DataLineStyle;

	if( GetRadioButton( IDC_MARKER_FREQUENCY_EVERY ) == TRUE )
	{
		tempChart.m_MarkerFrequency[m_CurDataSet] = 1;
	}
	else if( GetRadioButton( IDC_MARKER_FREQUENCY_NTH ) == TRUE )
	{
		tempChart.m_MarkerFrequency[m_CurDataSet] = m_MarkerFrequencyNumber;
	} else
	{
		tempChart.m_MarkerFrequency[m_CurDataSet] = -(int)(m_MarkerFrequencyTotal);
	}
}
예제 #4
0
파일: radiobox.cpp 프로젝트: EdgarTx/wx
// Show a specific button
bool wxRadioBox::Show(unsigned int item, bool show)
{
    wxRadioButton *btn = GetRadioButton(item);
    if(btn)
    {
        bool ret = btn->Show(show);
        RefreshRect(btn->GetRect());
        return ret;
    }
    return false;
}
예제 #5
0
BOOL CTreeOptionsCtrlEx::SetRadioButton(HTREEITEM hParent, int nIndex)
{
	//Validate our parameters
	ASSERT(IsGroup(hParent)); //Parent item must be a group item

	//Iterate through the child items and turn on the specified one and turn off all the other ones
	HTREEITEM hChild = GetNextItem(hParent, TVGN_CHILD);

	//Turn of redraw to Q all the changes we're going to make here
	SetRedraw(FALSE);

	int i=0;
	BOOL bCheckedSomeItem = FALSE;
	while (hChild)
	{
		//if we reach a non radio button then break out of the loop
		if (!IsRadioButton(hChild))
			break;

		if (i == nIndex)
		{
			//Turn this item on
			BOOL bOldState;
			GetRadioButton(hChild, bOldState);
			VERIFY(SetItemImage(hChild, 3, 3));
			bCheckedSomeItem = TRUE;
			if (!bOldState)
				NotifyParent(BN_CLICKED, hChild);
		}
		else
		{
			BOOL bEnable;
			VERIFY(GetRadioButtonEnable(hChild, bEnable));

			//Turn this item off
			if (bEnable)
				VERIFY(SetItemImage(hChild, 2, 2));
			else
				VERIFY(SetItemImage(hChild, 4, 4));
		}

		//Move on to the next item
		hChild = GetNextItem(hChild, TVGN_NEXT);
		++i;
	}
	ASSERT(bCheckedSomeItem); //You specified an index which does not exist

	//Reset the redraw flag
	SetRedraw(TRUE);

	return TRUE;
}
BOOL CTreeOptionsCtrlEx::SetRadioButton(HTREEITEM hItem)
{
	//Validate our parameters
	ASSERT(IsRadioButton(hItem)); //Must be a radio item to check it

	//Iterate through the sibling items and turn them all off except this one
	HTREEITEM hParent = GetNextItem(hItem, TVGN_PARENT);
	ASSERT(IsGroup(hParent)); //Parent item must be a group item

	//Iterate through the child items and turn on the specified one and turn off all the other ones
	HTREEITEM hChild = GetNextItem(hParent, TVGN_CHILD);

	//Turn of redraw to Q all the changes we're going to make here
	SetRedraw(FALSE);

	while (hChild)
	{
		//if we reach a non radio button then break out of the loop
		if (!IsRadioButton(hChild))
			break;

		if (hChild == hItem)
		{
			//Turn this item on
			BOOL bOldState;
			GetRadioButton(hChild, bOldState);
			BOOL bSuccess = SetItemImage(hChild, 3, 3);
			ASSERT(bSuccess);
			if (!bOldState)
				NotifyParent(BN_CLICKED, hChild);
		}
		else
		{
			BOOL bEnable;
			VERIFY(GetRadioButtonEnable(hChild, bEnable));

			//Turn this item off
			if (bEnable)
				VERIFY(SetItemImage(hChild, 2, 2));
			else
				VERIFY(SetItemImage(hChild, 6, 6));
		}

		//Move on to the next item
		hChild = GetNextItem(hChild, TVGN_NEXT);
	}

	//Reset the redraw flag
	SetRedraw(TRUE);

	return TRUE;
}
void Get_Object(unsigned int X, unsigned int Y) {
  button_order        = -1;
  image_order         = -1;
  radio_button_order    = -1;
  //  Buttons
  for ( _object_count = 0 ; _object_count < CurrentScreen->ButtonsCount ; _object_count++ ) {
    local_button = GetButton(_object_count);
    if (local_button->Active == 1) {
      if (IsInsideObject(X, Y, local_button->Left, local_button->Top,
                         local_button->Width, local_button->Height) == 1) {
        button_order = local_button->Order;
        exec_button = local_button;
      }
    }
  }

  //  Images
  for ( _object_count = 0 ; _object_count < CurrentScreen->ImagesCount ; _object_count++ ) {
    local_image = GetImage(_object_count);
    if (local_image->Active == 1) {
      if (IsInsideObject(X, Y, local_image->Left, local_image->Top,
                         local_image->Width, local_image->Height) == 1) {
        image_order = local_image->Order;
        exec_image = local_image;
      }
    }
  }

  // RadioButtons
  for ( _object_count = 0 ; _object_count < CurrentScreen->RadioButtonsCount ; _object_count++ ) {
    local_radio_button = GetRadioButton(_object_count);
    if (local_radio_button->Active == 1) {
      if (IsInsideObject(X, Y, local_radio_button->Left, local_radio_button->Top,
                         local_radio_button->Width, local_radio_button->Height) == 1) {
        radio_button_order = local_radio_button->Order;
        exec_radio_button = local_radio_button;
      }
    }
  }

  _object_count = -1;
  if (button_order > _object_count)
    _object_count = button_order;
  if (image_order >  _object_count )
    _object_count = image_order;
  if (radio_button_order >  _object_count )
    _object_count = radio_button_order;
}
예제 #8
0
파일: radiobox.cpp 프로젝트: EdgarTx/wx
void wxRadioBox::DoMoveWindow(int x, int y, int width, int height)
{
    wxRect oldRect = GetRect();

    m_pos.x = x;
    m_pos.y = y;
    m_size.x = width;
    m_size.y = height;

    const bool use_cols = HasFlag(wxRA_SPECIFY_COLS);

    const unsigned int n = GetCount();
    unsigned int minor = n / GetMajorDim();
    if(n % GetMajorDim() > 0)
        minor++;

    unsigned int i = 0;
    for ( unsigned int j = 0; j < minor; j++ )
    {
        for ( unsigned int k = 0; k < GetMajorDim(); k++ )
        {
            if(i<n)
            {
                wxPoint start, end;
                start.x = (use_cols ? (k*m_size.x)/GetMajorDim() : (j*m_size.x)/minor);
                start.y = (use_cols ? (j*m_size.y)/minor : (k*m_size.y)/GetMajorDim());
                end.x = (use_cols ? ((k+1)*m_size.x)/GetMajorDim() : ((j+1)*m_size.x)/minor);
                end.y = (use_cols ? ((j+1)*m_size.y)/minor : ((k+1)*m_size.y)/GetMajorDim());
                wxRadioButton* rb = GetRadioButton(i);
                if(rb)
                {
                    rb->SetSize(start.x,start.y,end.x-start.x-1,end.y-start.y-1);
                }
                i++;
            }
        }
    }

    // refresh old and new area
    GetParent()->RefreshRect(oldRect.Union(GetRect()));
}
예제 #9
0
파일: radiobox.cpp 프로젝트: EdgarTx/wx
void wxRadioBox::SetString(unsigned int item, const wxString& label)
{
    wxRadioButton *btn = GetRadioButton(item);
    if(btn)
        btn->SetLabel(label);
}
void DrawScreen(TScreen *aScreen) {
 int order;
  unsigned short button_idx;
  TButton *local_button;
  unsigned short image_idx;
  TImage *local_image;
  unsigned short radio_button_idx;
  TRadioButton *local_radio_button;
  char save_bled, save_bled_direction;

  object_pressed = 0;
  order = 0;
  button_idx = 0;
  image_idx = 0;
  radio_button_idx = 0;
  CurrentScreen = aScreen;

  if ((display_width != CurrentScreen->Width) || (display_height != CurrentScreen->Height)) {
    save_bled = TFT_BLED;
    save_bled_direction = TFT_BLED_Direction;
    TFT_BLED_Direction = 0;
    TFT_BLED           = 0;
    TFT_Set_Active(Set_Index, Write_Command, Write_Data);
    TFT_Init(CurrentScreen->Width, CurrentScreen->Height);
    TFT_Set_Ext_Buffer(TFT_Get_Data);
    TP_TFT_Init(CurrentScreen->Width, CurrentScreen->Height, 13, 12);                                  // Initialize touch panel
    TP_TFT_Set_ADC_Threshold(ADC_THRESHOLD);                              // Set touch panel ADC threshold
    TFT_Fill_Screen(CurrentScreen->Color);
    display_width = CurrentScreen->Width;
    display_height = CurrentScreen->Height;
    TFT_BLED           = save_bled;
    TFT_BLED_Direction = save_bled_direction;
  }
  else
    TFT_Fill_Screen(CurrentScreen->Color);


  while (order < CurrentScreen->ObjectsCount) {
    if (button_idx < CurrentScreen->ButtonsCount) {
      local_button = GetButton(button_idx);
      if (order == local_button->Order) {
        button_idx++;
        order++;
        DrawButton(local_button);
      }
    }

    if (image_idx  < CurrentScreen->ImagesCount) {
      local_image = GetImage(image_idx);
      if (order == local_image->Order) {
        image_idx++;
        order++;
        DrawImage(local_image);
      }
    }

    if (radio_button_idx  < CurrentScreen->RadioButtonsCount) {
      local_radio_button = GetRadioButton(radio_button_idx);
      if (order == local_radio_button->Order) {
        radio_button_idx++;
        order++;
        DrawRadioButton(local_radio_button);
      }
    }

  }
}