コード例 #1
0
ファイル: ColourPanel.cpp プロジェクト: ak4hige/myway3d
	ColourPanel::ColourPanel()
	{
		initialiseByAttributes(this);

		mCurrentColour = MyGUI::Colour::Green;
		mBaseColour = MyGUI::Colour::Green;

		mColourRect->eventMouseButtonPressed += MyGUI::newDelegate(this, &ColourPanel::notifyMouseButtonPressed);
		mColourRect->eventMouseDrag += MyGUI::newDelegate(this, &ColourPanel::notifyMouseDrag);
		mImageColourPicker->eventMouseDrag += MyGUI::newDelegate(this, &ColourPanel::notifyMouseDrag);
		mScrollRange->eventScrollChangePosition += MyGUI::newDelegate(this, &ColourPanel::notifyScrollChangePosition);

		mEditRed->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChange);
		mEditGreen->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChange);
		mEditBlue->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChange);

		mOk->eventMouseButtonClick += MyGUI::newDelegate(this, &ColourPanel::notifyMouseButtonClick);

		mColourRange.push_back(MyGUI::Colour(1, 0, 0));
		mColourRange.push_back(MyGUI::Colour(1, 0, 1));
		mColourRange.push_back(MyGUI::Colour(0, 0, 1));
		mColourRange.push_back(MyGUI::Colour(0, 1, 1));
		mColourRange.push_back(MyGUI::Colour(0, 1, 0));
		mColourRange.push_back(MyGUI::Colour(1, 1, 0));
		mColourRange.push_back(mColourRange[0]);

		createTexture();

		updateFirst();
	}
コード例 #2
0
ファイル: ColourPanel.cpp プロジェクト: fake-human/HiveGame
	ColourPanel::ColourPanel() :
		Dialog(),
		mAlphaSupport(true)
	{
		initialiseByAttributes(this);
		mTextureName = MyGUI::utility::toString((size_t)this, "_ColourGradient");

		mCurrentColour = MyGUI::Colour::Green;
		mBaseColour = MyGUI::Colour::Green;

		mColourRect->eventMouseButtonPressed += MyGUI::newDelegate(this, &ColourPanel::notifyMouseButtonPressed);
		mColourRect->eventMouseDrag += MyGUI::newDelegate(this, &ColourPanel::notifyMouseDrag);
		mImageColourPicker->eventMouseDrag += MyGUI::newDelegate(this, &ColourPanel::notifyMouseDrag);
		mScrollRange->eventScrollChangePosition += MyGUI::newDelegate(this, &ColourPanel::notifyScrollChangePosition);
		mAlphaSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &ColourPanel::notifyScrollChangePositionAlpha);

		mEditRed->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChange);
		mEditGreen->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChange);
		mEditBlue->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChange);
		mInputAlpha->eventEditTextChange += MyGUI::newDelegate(this, &ColourPanel::notifyEditTextChangeAlpha);

		mOk->eventMouseButtonClick += MyGUI::newDelegate(this, &ColourPanel::notifyMouseButtonClickOk);
		mCancel->eventMouseButtonClick += MyGUI::newDelegate(this, &ColourPanel::notifyMouseButtonClickCancel);

		MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>(false);
		if (window != nullptr)
			window->eventWindowButtonPressed += MyGUI::newDelegate(this, &ColourPanel::notifyWindowButtonPressed);

		mColourRange.push_back(MyGUI::Colour(1, 0, 0));
		mColourRange.push_back(MyGUI::Colour(1, 0, 1));
		mColourRange.push_back(MyGUI::Colour(0, 0, 1));
		mColourRange.push_back(MyGUI::Colour(0, 1, 1));
		mColourRange.push_back(MyGUI::Colour(0, 1, 0));
		mColourRange.push_back(MyGUI::Colour(1, 1, 0));
		mColourRange.push_back(mColourRange[0]);

		mMainWidget->setVisible(false);

		createTexture();

		updateFirst();
	}
コード例 #3
0
// delete the specified key from the Btree
RC deleteKey(BTreeHandle *tree, Value *key) {

	Btree* leaf      = NULL;
	// get the desired leaf
	leaf = find_leaf(tree, key);

	// get the left node
	Btree* childLeft = NULL;
	childLeft = leaf->prev;

	// get the tree stastistics data
	Btree_stat *info = NULL;
	info = tree->mgmtData;

	if (leaf != NULL) {

		if (childLeft == NULL) {

			// no child
			// delete the entry and adjust the tree if needed
			delete_entry(tree, leaf, key);

			// done
			return RC_OK;
		}

		if (key->v.intV == leaf->keys[0]) {

			// the key exists in this leaf node
			// delete it
			delete_entry(tree, leaf, key);

			// check if there is underflow in the node capacity
			if (leaf->num_keys == 0) {

				// merge with the left sibling
				childLeft->next = leaf->next;

				// check if we need to propagate this change up the tree
				delete_parent_nodes_inital(info, leaf, key);

				// done
				return RC_OK;
			}

			// update the prent node
			updateFirst(leaf, key);

			return RC_OK;

		} else {

			delete_entry(tree, leaf, key);

			if (leaf) {

				// see of there is underflow
				if (checkUnderflow(info, leaf)) {

					// if yes, merge with left sibling
					if (childLeft) {

						// check the number of keys even after splitting
						if (childLeft->num_keys > splitNode(info->order)
						&&  childLeft->num_keys != info->order) {

							// we need to redistribute the keys
							// to balance out
							redistribute(info, childLeft, leaf);

						} else {
							// just merge
							merge_nodes(info, childLeft, leaf);
						}
					}
				}
			}

			return RC_OK;
		}
	}

	// all ok
	return RC_OK;
}