wxWebUpdatePackage *wxWebUpdateListCtrl::GetNextPackageToDownload()
{
    if (!IsShown()) {

        // we are hidden; thus the user cannot check the packages he wants
        // to install... we will just select automatically *all* available
        // packages...
        for (int i=0; i < GetItemCount(); i++)
            if (CanBeChecked(i))
                Check(i, TRUE);
    }

    // launch the download of the selected packages
    int todownload = -1;
    for (int i=0; i<GetItemCount(); i++) {

        // download the first package which is checked and that has not been
        // downloaded yet...
        if (IsChecked(i) && !m_bDownloaded[GetPackageIndexForItem(i)]) {
            todownload = i;
            break;
        }
    }

    if (todownload == -1)
        return NULL;

    return  &m_arrRemotePackages[GetPackageIndexForItem(todownload)];
}
void wxCheckListBox::GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value )
{
    if ( col == m_checkColumn )
        value.Check( IsChecked( n ) );
    else
        wxListBox::GetValueCallback( n, col, value );
}
Beispiel #3
0
FX_BOOL CPWL_CheckBox::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag)
{
	if (IsReadOnly()) return FALSE;

	SetCheck(!IsChecked());
	return TRUE;
}
Beispiel #4
0
bool wxCheckListBox::PerformAction(const wxControlAction& action,
                                   long numArg,
                                   const wxString& strArg)
{
    if ( action == wxACTION_CHECKLISTBOX_TOGGLE )
    {
        int sel = (int)numArg;
        if ( sel == -1 )
        {
            sel = GetSelection();
        }

        if ( sel != -1 )
        {
            Check(sel, !IsChecked(sel));

            SendEvent(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, sel);
        }
    }
    else
    {
        return wxListBox::PerformAction(action, numArg, strArg);
    }

    return true;
}
Beispiel #5
0
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
{
    // clicking on the item selects it, clicking on the checkmark toggles
    if ( event.GetX() <= 20 /*check width*/ ) {
        int lineheight ;
        int topcell ;
#if TARGET_CARBON
        Point pt ;
        GetListCellSize( (ListHandle)m_macList , &pt ) ;
        lineheight = pt.v ;
        ListBounds visible ;
        GetListVisibleCells( (ListHandle)m_macList , &visible ) ;
        topcell = visible.top ;
#else
        lineheight =  (**(ListHandle)m_macList).cellSize.v ;
        topcell = (**(ListHandle)m_macList).visible.top ;
#endif
        size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
        
        if ( nItem < (size_t)m_noItems )
        {
            Check(nItem, !IsChecked(nItem) ) ;
            wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
            event.SetInt(nItem);
            event.SetEventObject(this);
            GetEventHandler()->ProcessEvent(event);
        }
        //else: it's not an error, just click outside of client zone
    }
    else {
        // implement default behaviour: clicking on the item selects it
        event.Skip();
    }
}
Beispiel #6
0
void OptionPage::DisableIfChecked(wxControl *cbx, wxControl *ctrl) {
	auto cb = dynamic_cast<wxCheckBox*>(cbx);
	if (!cb) return;

	ctrl->Enable(!cb->IsChecked());
	cb->Bind(wxEVT_CHECKBOX, [=](wxCommandEvent& evt) { ctrl->Enable(!evt.GetInt()); evt.Skip(); });
}
    void OnCheck(wxCommandEvent&)
    {
        if (m_Def->m_Action==NULL) return;

        m_Def->m_Context=m_Context;
        m_Def->m_Action->Action(IsChecked() ? 1 : 0);
        m_Def->Update();
    }
Beispiel #8
0
LRESULT CSysCheckBoxUI::CommandHandler( int code )
{
	if(GetManager() && code == BN_CLICKED){
		GetManager()->SendNotify(this, DUI_MSGTYPE_CLICK, WPARAM(IsChecked()));
		return 0;
	}
	return 0;
}
Beispiel #9
0
void SCheckBox::OnLButtonUp(UINT nFlags, CPoint point)
{
    if (IsChecked())
        ModifyState(0, WndState_Check,TRUE);
    else
        ModifyState(WndState_Check, 0,TRUE);
    __super::OnLButtonUp(nFlags,point);
}
Beispiel #10
0
 bool NFrameBase::SetCheck(bool checked)
 {
     if(checked == IsChecked())
         return false;
     ForceInvalidate();
     Util::Misc::CheckFlag(frameStatus_, NFrameBase::StatusChecked, checked);
     return true;
 }
void wxRearrangeList::OnCheck(wxCommandEvent& event)
{
    // update the internal state to match the new item state
    const int n = event.GetInt();

    if ( (m_order[n] >= 0) != IsChecked(n) )
        m_order[n] = ~m_order[n];
}
 void SCaptureButton::OnMouseMove( UINT nFlags, CPoint point )
 {
     if(IsChecked())
     {
         EventCapture evt(this,point);
         FireEvent(evt);
     }
 }
void Checkbox::RenderCheck(Rect& rectArea)
{
    Rect rectBox = rectArea;

    int iBoxMargin = int(rectArea.Height() * 0.2);
    int iBoxMarginRight = int(rectArea.Height() * 0.8 * 0.75);

    rectBox.Left(rectBox.Left() + iBoxMargin);
    rectBox.Right(rectBox.Left() + iBoxMarginRight);
    rectBox.Top(rectBox.Top() + iBoxMargin);
    rectBox.Bottom(rectBox.Bottom() - iBoxMargin);

    OpenGL::PushedAttributes attr(GL_ENABLE_BIT | GL_LINE_BIT | GL_POINT_BIT);

    glDisable(GL_TEXTURE_2D);
    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_POINT_SMOOTH);

    Color cBox = GetAttrAsColor(CheckboxAttr::BoxColor);
    glColor4ubv(cBox.m_color);
    glLineWidth(2.0);
    glBegin(GL_LINE_LOOP);
    glVertex2i(rectBox.Left(), rectBox.Bottom());
    glVertex2i(rectBox.Right(), rectBox.Bottom());
    glVertex2i(rectBox.Right(), rectBox.Top());
    glVertex2i(rectBox.Left(), rectBox.Top());
    glEnd();

    if (IsChecked())
    {
        double iCheckUnit = rectBox.Height() * 0.1;

        Point point1(int(rectBox.Left() + 3 * iCheckUnit), int(rectBox.Bottom() - 6 * iCheckUnit));
        Point point2(int(rectBox.Left() + 6 * iCheckUnit), int(rectBox.Bottom() - 3 * iCheckUnit));
        Point point3(int(rectBox.Left() + 11* iCheckUnit), int(rectBox.Bottom() - 11* iCheckUnit));

        Color cCheck = GetAttrAsColor(CheckboxAttr::CheckColor);
        glColor4ubv(cCheck.m_color);
        glLineWidth(4.0);
        glBegin(GL_LINES);
        glVertex2i(point1.X(), point1.Y());
        glVertex2i(point2.X(), point2.Y());
        glVertex2i(point2.X(), point2.Y());
        glVertex2i(point3.X(), point3.Y());
        glEnd();

        glPointSize(3.0);
        glBegin(GL_POINTS);
        glVertex2i(point1.X(), point1.Y());
        glVertex2i(point2.X(), point2.Y());
        glVertex2i(point3.X(), point3.Y());
        glEnd();
    }

    // adjust rect for size of checkbox
    int iOffset = int(rectArea.Height() * 1.1);
    rectArea.Left(rectArea.Left() + iOffset);
}
void wxRearrangeList::Check(unsigned int item, bool check)
{
    if ( check == IsChecked(item) )
        return;

    wxCheckListBox::Check(item, check);

    m_order[item] = ~m_order[item];
}
bool Checkbox::OnMouseButtonEvent(bool bPressed, int /*iMouseButton*/, unsigned int /*x*/, unsigned int /*y*/)
{
    if (bPressed)
        return false;

    SetCheck(!IsChecked());

    return true;
}
Beispiel #16
0
void PolyCheckBox::Save(wxString const &group)
{
	wxString key = group + wxT("polygon");

	wxConfigBase *config = wxConfig::Get();

	config->Write(key, static_cast<long>(IsChecked()));

}
Beispiel #17
0
bool CMenuPlot::SyncValue()
{
  bool bRtn = false;
  if(!m_bPreview)
  {
    bRtn = IsChecked(_ID(IDmenuPlotSync));
  }
  return bRtn;
}
Beispiel #18
0
int wxCheckedListCtrl::GetCheckedItemCount() const
{
	int res = 0;
	for (int i=0; i<GetItemCount(); i++)
		if (IsChecked(i))
			res++;

	return res;
}
Beispiel #19
0
void wxRearrangeList::OnCheck(wxCommandEvent& event)
{
    // update the internal state to match the new item state
    const int n = event.GetInt();

    m_order[n] = ~m_order[n];

    wxASSERT_MSG( (m_order[n] >= 0) == IsChecked(n),
                  "discrepancy between internal state and GUI" );
}
void ToggleButton::SyncTextState()
{
    Boolean checked = IsChecked();
    if (checked && mTextOn != NULL) {
        SetText(mTextOn);
    }
    else if (!checked && mTextOff != NULL) {
        SetText(mTextOff);
    }
}
Beispiel #21
0
void SRadioBox::SetCheck( BOOL bCheck )
{
    if(IsChecked() == bCheck) return;
    if(bCheck)
    {
        SRadioBox *pCurChecked=(SRadioBox*)GetSelectedSiblingInGroup();
        if(pCurChecked) pCurChecked->SetCheck(FALSE);
    }
    SWindow::SetCheck(bCheck);
}
bool Checkbox::OnKeyboardEvent(bool bKeyDown, unsigned int sym, unsigned int /*mod*/)
{
    if (!bKeyDown && sym == SDLK_SPACE)
    {
        SetCheck(!IsChecked());
        return true;
    }

    return false;
}
Beispiel #23
0
void wxFlatButton::DoActivate()
{
    if(!IsEnabled())
        return;

    wxFlatButtonEvent btnEvent(wxEVT_CMD_FLATBUTTON_CLICK);
    btnEvent.SetEventObject(this);

    if(m_kind == kKindChek) {
        if(HasMenu()) {
            if(!IsChecked()) {
                m_state = kStatePressed;
                m_isChecked = true;
                Refresh();
                CallAfter(&wxFlatButton::DoShowContextMenu);

            } else {
                m_state = kStateNormal;
                m_isChecked = false;
                Refresh();
            }

            // We don't fire an event
            return;
        } else {
            if(IsChecked()) {
                // a checked button is about to be unchecked
                btnEvent.SetInt(0);
                m_state = kStateNormal;
                m_isChecked = false;
            } else {
                // Checking the button
                btnEvent.SetInt(1);
                m_isChecked = true;
                m_state = kStatePressed;
            }
        }
    } else {
        m_state = kStateHover;
    }
    GetEventHandler()->AddPendingEvent(btnEvent);
    Refresh();
}
void CGumpRadio::Draw( CDC* dc, CRect rect )
{
	STATE state = IsChecked() ? CHECKED : NORMAL;
	if (!m_pGump[state]) {
		CGumpEntity::DrawRadiobutton(dc,rect);
		return;
	}
	
	m_pGump[state]->DrawGump(dc, rect.TopLeft(), GetZoom());
}
Beispiel #25
0
// Convert the contents of the form to the VH_OPTION
void NmEditVhOptionFormToVH(HWND hWnd, VH_OPTION *t)
{
	char tmp[MAX_SIZE];
	BUF *b;
	// Validate arguments
	if (hWnd == NULL || t == NULL)
	{
		return;
	}

	Zero(t, sizeof(VH_OPTION));

	GetTxtA(hWnd, E_MAC, tmp, sizeof(tmp));
	b = StrToBin(tmp);
	if (b != NULL)
	{
		if (b->Size == 6)
		{
			Copy(t->MacAddress, b->Buf, 6);
		}
		FreeBuf(b);
	}

	UINTToIP(&t->Ip, IpGet(hWnd, E_IP));
	UINTToIP(&t->Mask, IpGet(hWnd, E_MASK));

	t->UseNat = IsChecked(hWnd, R_USE_NAT);
	t->Mtu = GetInt(hWnd, E_MTU);
	t->NatTcpTimeout = GetInt(hWnd, E_TCP);
	t->NatUdpTimeout = GetInt(hWnd, E_UDP);

	t->UseDhcp = IsChecked(hWnd, R_USE_DHCP);
	UINTToIP(&t->DhcpLeaseIPStart, IpGet(hWnd, E_DHCP_START));
	UINTToIP(&t->DhcpLeaseIPEnd, IpGet(hWnd, E_DHCP_END));
	UINTToIP(&t->DhcpSubnetMask, IpGet(hWnd, E_DHCP_MASK));
	t->DhcpExpireTimeSpan = GetInt(hWnd, E_EXPIRES);
	UINTToIP(&t->DhcpGatewayAddress, IpGet(hWnd, E_GATEWAY));
	UINTToIP(&t->DhcpDnsServerAddress, IpGet(hWnd, E_DNS));
	UINTToIP(&t->DhcpDnsServerAddress2, IpGet(hWnd, E_DNS2));
	GetTxtA(hWnd, E_DOMAIN, t->DhcpDomainName, sizeof(t->DhcpDomainName));
	t->SaveLog = IsChecked(hWnd, R_SAVE_LOG);
}
void wxRearrangeList::Swap(int pos1, int pos2)
{
    // update the internally stored order
    wxSwap(m_order[pos1], m_order[pos2]);


    // and now also swap all the attributes of the items

    // first the label
    const wxString stringTmp = GetString(pos1);
    SetString(pos1, GetString(pos2));
    SetString(pos2, stringTmp);

    // then the checked state
    const bool checkedTmp = IsChecked(pos1);
    wxCheckListBox::Check(pos1, IsChecked(pos2));
    wxCheckListBox::Check(pos2, checkedTmp);

    // and finally the client data, if necessary
    switch ( GetClientDataType() )
    {
        case wxClientData_None:
            // nothing to do
            break;

        case wxClientData_Object:
            {
                wxClientData * const dataTmp = DetachClientObject(pos1);
                SetClientObject(pos1, DetachClientObject(pos2));
                SetClientObject(pos2, dataTmp);
            }
            break;

        case wxClientData_Void:
            {
                void * const dataTmp = GetClientData(pos1);
                SetClientData(pos1, GetClientData(pos2));
                SetClientData(pos2, dataTmp);
            }
            break;
    }
}
ECode ToggleSlider::OnStopTrackingTouch(
    /* [in] */ ISeekBar* seekBar)
{
    mTracking = FALSE;
    if (mListener != NULL) {
        Int32 process;
        mSlider->GetProgress(&process);
        mListener->OnChanged(THIS_PROBE(IToggleSlider), mTracking, IsChecked(), process);
    }
    return NOERROR;
}
Beispiel #28
0
void cgUICheck::DrawBackground( const cgRectF& clipRect )
{
	if (IfFillBackground())
	{
		cgColor uDrawColor = m_uBackColor;
		if (IsChecked())
			uDrawColor = m_uCheckedColor;
	
		cgUIRender::GetRender()->FillRect(clipRect, uDrawColor);
	}
}
unsigned int PositionsPopup::GetCheckedItems(wxArrayInt &checkedItems) const
{
	unsigned int const itemsCount = GetCount();
	checkedItems.Empty();
	for( unsigned int i = 0; i < itemsCount; ++i )
	{
		if( IsChecked( i ) )
			checkedItems.Add( i );
	}
	return checkedItems.GetCount();
}
Beispiel #30
0
//
/// Toggle the state of the item.
/// If the item has three states, the cycle goes from
///   unchecked -> checked -> indeterminate -> back to unchecked.
/// Otherwise the state toggles between
///   unchecked and checked.
//
void
TCheckListItem::Toggle()
{
  if (!IsEnabled())
    return;
  if (HasThreeStates) {
    if (IsIndeterminate())
      Uncheck();
    else if (IsChecked())
      SetIndeterminate();
    else
      Check();
  }
  else {
   if (IsChecked())
     Uncheck();
   else
     Check();
  }
}