Beispiel #1
0
BOOL CFindJava2Dlg::OnInitDialog() {
    CDialog::OnInitDialog();

    SetWindowText(getAppName());

    // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);			// Set big icon
    SetIcon(m_hIcon, FALSE);		// Set small icon

    // Initialize list controls
    mPathsListCtrl.SetExtendedStyle(
        mPathsListCtrl.GetExtendedStyle() |
        LVS_EX_CHECKBOXES | 
        LVS_EX_FULLROWSELECT | 
        LVS_EX_GRIDLINES);

    // We want 2 columns: Java version and path
    mPathsListCtrl.InsertColumn(0, _T("Version"), LVCFMT_RIGHT, 60,  0);
    mPathsListCtrl.InsertColumn(1, _T("Path"),     LVCFMT_LEFT, 386, 0);

    mJavaFinder->findJavaPaths(&mPaths);
    fillPathsList();
    adjustButtons();

    return TRUE;  // return TRUE  unless you set the focus to a control
}
Beispiel #2
0
// Checks the given index if valid. Unchecks all other items.
//
// If index >= 0, it is used to select that item from the ListControl.
// Otherwise if path != nullptr, it is used to find the item and select it.
//
// Side effect: in both cases, mSelectedIndex is set to the matching index or -1.
//
// If index is invalid and path isn't in the mPaths list, all items are unselected
// so calling this with (0, nullptr) will clear the current selection.
void CFindJava2Dlg::selectPath(int index, const CJavaPath *path) {

    const CJavaPath *foundPath;
    // If index is not defined, find the given path in the internal list.
    // If path is not defined, find its index in the internal list.
    int i = 0;
    int n = mPathsListCtrl.GetItemCount();
    for (const CJavaPath &p : mPaths) {
        if (index < 0 && path != nullptr && p == *path) {
            index = i;
            foundPath = path;
        } else if (index == i) {
            foundPath = &p;
        }

        // uncheck any marked path
        if (i != index && i < n && mPathsListCtrl.GetCheck(i)) {
            mPathsListCtrl.SetCheck(i, FALSE);
        }

        ++i;
    }

    mSelectedIndex = index;
    if (index >= 0 && index <= n) {
        mPathsListCtrl.SetCheck(index, TRUE);
    }

    adjustButtons();
}
int FrmImportRegions::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = SecondaryFrm::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0:
            Apply();
            break;
        case 1:
            Cancel();
            break;
        case 2:
            adjustButtons();
            break;
        case 3:
            refreshFields((*reinterpret_cast< QString(*)>(_a[1])));
            break;
        case 4:
            addItems2List();
            break;
        default:
            ;
        }
        _id -= 5;
    }
    return _id;
}
Beispiel #4
0
// An item in the list has changed, toggle checkmark as needed.
void CFindJava2Dlg::OnLvnItemchangedPathList(NMHDR *pNMHDR, LRESULT *pResult) {
    *pResult = FALSE;
    LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);

    if ((pNMLV->uChanged & LVIF_STATE) != 0) {
        // Item's state has changed. Check the selection to see if it needs to be adjusted.
        int index = pNMLV->iItem;

        UINT oldState = pNMLV->uOldState;
        UINT newState = pNMLV->uNewState;

        if ((oldState & LVIS_STATEIMAGEMASK) != 0 || (newState & LVIS_STATEIMAGEMASK) != 0) {
            // Checkbox uses the STATEIMAGE: 1 for unchecked, 2 for checked.
            // Checkbox is checked when (old/new-state & state-image-mask) == INDEXTOSTATEIMAGEMASK(2).

            bool oldChecked = (oldState & LVIS_STATEIMAGEMASK) == INDEXTOSTATEIMAGEMASK(2);
            bool newChecked = (newState & LVIS_STATEIMAGEMASK) == INDEXTOSTATEIMAGEMASK(2);

            if (oldChecked && !newChecked && index == mSelectedIndex) {
                mSelectedIndex = -1;
                adjustButtons();
            } else if (!oldChecked && newChecked && index != mSelectedIndex) {
                // Uncheck any checked rows if any
                for (int n = mPathsListCtrl.GetItemCount() - 1; n >= 0; --n) {
                    if (n != index && mPathsListCtrl.GetCheck(n)) {
                        mPathsListCtrl.SetCheck(n, FALSE);
                    }
                }

                mSelectedIndex = index;
                adjustButtons();
            }
            // We handled this case, don't dispatch it further
            *pResult = TRUE;
        }
    }
}
Beispiel #5
0
bool ContextMenu::animStep(float64 ms) {
	float64 dt = ms / 150;
	bool res = true;
	if (dt >= 1) {
		a_opacity.finish();
		if (_hiding) {
			hideFinish();
		}
		res = false;
	} else {
		a_opacity.update(dt, anim::linear);
	}
	adjustButtons();
	update();
	return res;
}