Exemplo n.º 1
0
//////////
//
// Called to release all fonts allocated in this block
//
//////
	void iFont_releaseAll(SBuilder* fontRoot, bool tlDeleteSelf)
	{
		u32		lnI;
		SFont*	font;


		// Make sure our environment is sane
		if (fontRoot)
		{
			//////////
			// Delete all allocated fonts
			//////
				for (lnI = 0; lnI < fontRoot->populatedLength; lnI += sizeof(SFont))
				{
					// Grab the pointer
					font = (SFont*)(fontRoot->data_u8 + lnI);

					// Delete this font
					if (font->isUsed)
					{
						iFont_delete(&font, false);	// Delete the font
						font->isUsed = false;		// Mark the slot unused
					}
				}


			//////////
			// Delete self
			//////
				if (tlDeleteSelf)
					iBuilder_freeAndRelease(&fontRoot);
		}
	}
Exemplo n.º 2
0
	void iiSubobj_resetToDefaultLabel(SObject* label, bool tlResetProperties, bool tlResetMethods, SObjPropMap* propList, u32 tnPropCount, SObjEventMap* eventList, u32 tnEventCount)
	{
		logfunc(__FUNCTION__);
		if (label)
		{
			//////////
			// Reset the common settings
			//////
				iiObj_resetToDefaultCommon(label, true, true, propList, tnPropCount, eventList, tnEventCount);


			//////////
			// Set default size and position
			//////
				SetRect(&label->rc, 0, 0, 40, 17);
				SetRect(&label->rco, 0, 0, 40, 17);
				SetRect(&label->rcp, 0, 0, 40, 17);

				// Set the size
				iObj_setSize(label, 0, 0, 40, 17);

				// Font
				iFont_delete(&label->p.font, true);
				label->p.font = iFont_duplicate(gsFontDefault);


			//////////
			// Set the default colors
			//////
				propSetBackColor(label, whiteColor);
				propSetForeColor(label, blackColor);


			//////////
			// Set the characteristics
			//////
				propSetAlignment(label, _ALIGNMENT_LEFT);
				propSetCaption(label, cgcName_label);
				propSetBackStyle(label, _BACK_STYLE_TRANSPARENT);
				propSetBorderStyle(label, _BORDER_STYLE_NONE);
				propSetBorderColor(label, blackColor);
				propSetDisabledBackColor(label, disabledBackColor);
				propSetDisabledForeColor(label, disabledForeColor);
		}
	}
Exemplo n.º 3
0
	void iiSubobj_resetToDefaultTextbox(SObject* textbox, bool tlResetProperties, bool tlResetMethods, SObjPropMap* propList, u32 tnPropCount, SObjEventMap* eventList, u32 tnEventCount)
	{
		logfunc(__FUNCTION__);
		if (textbox)
		{
			//////////
			// Reset the common settings
			//////
				iiObj_resetToDefaultCommon(textbox, true, true, propList, tnPropCount, eventList, tnEventCount);


			//////////
			// Set default size and position
			//////
				SetRect(&textbox->rc, 0, 0, 100, 23);
				SetRect(&textbox->rco, 0, 0, 100, 23);
				SetRect(&textbox->rcp, 0, 0, 100, 23);

				// Set the size
				iObj_setSize(textbox, 0, 0, 100, 23);

				// Font
				iFont_delete(&textbox->p.font, true);
				textbox->p.font = iFont_duplicate(gsFontDefault);


			//////////
			// Set the defaults
			//////
				propSetAnchor(textbox, _ANCHOR_FIXED_NORESIZE);
				propSetBackColor(textbox, whiteColor);
				propSetForeColor(textbox, blackColor);
				propSetStyle(textbox, _STYLE_3D);
				propSetAlignment(textbox, _ALIGNMENT_LEFT);
				propSetBackStyle(textbox, _BACK_STYLE_OPAQUE);
				propSetBorderStyle(textbox, _BORDER_STYLE_NONE);
				propSetBorderColor(textbox, blackColor);
				propSetSelectedBackColor(textbox, selectedBackColor);
				propSetSelectedForeColor(textbox, selectedForeColor);
				propSetDisabledBackColor(textbox, disabledBackColor);
				propSetDisabledForeColor(textbox, disabledForeColor);

		}
	}
Exemplo n.º 4
0
	SFont* iFont_smaller(SFont* font, bool tlDeleteAfterCreateNew)
	{
		SFont* fontNew;


		// Make sure our environment is sane
		if (font && font->_size >= 4)
		{
			// Create the larger font
			fontNew = font;
			fontNew = iFont_create(fontNew->name.data_cu8, fontNew->_size - 1, fontNew->_weight, ((fontNew->isItalic) ? 1 : 0), ((fontNew->isUnderline) ? 1 : 0));
			if (!fontNew)
				return(font);

			// Delete the reference font if instructed
			if (tlDeleteAfterCreateNew)
				iFont_delete(&font, true);

			// Indicate our status
			return(fontNew);
		}
		// If we get here, failure
		return(font);
	}
Exemplo n.º 5
0
	void iiSubobj_resetToDefaultCheckbox(SObject* checkbox, bool tlResetProperties, bool tlResetMethods, SObjPropMap* propList, u32 tnPropCount, SObjEventMap* eventList, u32 tnEventCount)
	{
		SObject*	objChild;
		SBitmap*	bmp;
		RECT		lrc;


		logfunc(__FUNCTION__);
		if (checkbox)
		{
			//////////
			// Reset the common settings
			//////
				iiObj_resetToDefaultCommon(checkbox, true, true, propList, tnPropCount, eventList, tnEventCount);


			//////////
			// Set default size, position, font
			//////
				SetRect(&checkbox->rc, 0, 0, 60, 17);
				SetRect(&checkbox->rco, 0, 0, 60, 17);
				SetRect(&checkbox->rcp, 0, 0, 60, 17);

				// Set the size
				iObj_setSize(checkbox, 0, 0, 60, 17);

				// Font
				checkbox->p.font = iFont_duplicate(gsFontDefault9);


			//////////
			// Set the default values
			//////
				propSetValue_s32(checkbox, 0);

				propSetBackColor(checkbox, whiteColor);
				propSetForeColor(checkbox, blackColor);
				propSetAlignment(checkbox, _ALIGNMENT_LEFT);
				propSetStyle(checkbox, _STYLE_3D);
				propSetCaption(checkbox, cgcName_checkbox);
				propSetBackStyle(checkbox, _BACK_STYLE_TRANSPARENT);
				propSetBorderStyle(checkbox, _BORDER_STYLE_NONE);
				propSetBorderColor(checkbox, blackColor);
				propSetDisabledBackColor(checkbox, disabledBackColor);
				propSetDisabledForeColor(checkbox, disabledForeColor);


			//////////
			// Default child settings
			//////
				SetRect(&lrc, 0, 0, bmpArrowUl->bi.biWidth, bmpArrowUl->bi.biHeight);
				objChild = checkbox->firstChild;
				while (objChild)
				{
					// See which object this is
					if (objChild->objType == _OBJ_TYPE_IMAGE && propIsName_byText(objChild, cgcName_checkboxImage))
					{
						// Adjust the size
						iObj_setSize(objChild, objChild->rc.left, objChild->rc.top, 17, objChild->rc.bottom);

						// Checkbox image
						bmp = iBmp_allocate();
						iBmp_createBySize(bmp, 17, 17, 24);

						// Based on type, populate the image
						if (iObjProp_get_s32_direct(checkbox, _INDEX_VALUE) == 0)
						{
							// Off
							iBmp_scale(bmp, bmpCheckboxOff);	// Set the new

						} else {
							// On
							iBmp_scale(bmp, bmpCheckboxOn);		// Set the new
						}

						// Replicate that image for the over and down images
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP,			bmp);
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP_DOWN,	bmp);
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP_OVER,	bmp);

						// Delete the temporary image
						iBmp_delete(&bmp, true, true);

						// Add highlighting for the over and down
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_OVER);			iBmp_colorize(bmp, &lrc, colorMouseOver, false, 0.5f);
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_DOWN);			iBmp_colorize(bmp, &lrc, colorMouseDown, false, 0.5f);

						// Mark it for re-rendering
						objChild->isDirtyRender	= true;
						propSetVisible(objChild, _LOGICAL_TRUE);

					} else if (objChild->objType == _OBJ_TYPE_LABEL && propIsName_byText(objChild, cgcName_checkboxLabel)) {
						// Adjust the size
						iObj_setSize(objChild, 17, 0, 60, objChild->rc.bottom);

						// Checkbox label
						propSetCaption(objChild, cgcName_checkbox);
						propSetBackStyle(objChild, _BACK_STYLE_TRANSPARENT);
						iFont_delete(&objChild->p.font, true);
						objChild->p.font = iFont_duplicate(checkbox->p.font);

						// Mark it for re-rendering
						objChild->isDirtyRender	= true;
						propSetVisible(objChild, _LOGICAL_TRUE);
					}

					// Move to next object
					objChild = objChild->ll.nextObj;
				}
		}
	}
Exemplo n.º 6
0
	void iiSubobj_resetToDefaultCarousel(SObject* carousel, bool tlResetProperties, bool tlResetMethods, SObjPropMap* propList, u32 tnPropCount, SObjEventMap* eventList, u32 tnEventCount)
	{
		bool		llVisible;
		RECT		lrc;
		SBitmap*	bmp;
		SObject*	objChild;


		logfunc(__FUNCTION__);
		if (carousel)
		{
			//////////
			// Reset the common settings
			//////
				iiObj_resetToDefaultCommon(carousel, true, true, propList, tnPropCount, eventList, tnEventCount);


			//////////
			// Standard default settings
			//////
				propSetAlignment(carousel, _ALIGNMENT_BOTTOM);
				propSetTitlebar(carousel, _LOGICAL_FALSE);
				propSetBorderStyle(carousel, _BORDER_STYLE_FIXED);
				iFont_delete(&carousel->p.font, true);
				carousel->p.font = iFont_create(cgcFontName_windowTitleBar, 10, FW_NORMAL, false, false);


			//////////
			// Set colors to match the form, so on a subform they show up in nice contrast
			//////
				iObjProp_set_sbgra_direct(carousel, _INDEX_NWCOLOR, nwColor_form);
				iObjProp_set_sbgra_direct(carousel, _INDEX_NECOLOR, neColor_form);
				iObjProp_set_sbgra_direct(carousel, _INDEX_SWCOLOR, swColor_form);
				iObjProp_set_sbgra_direct(carousel, _INDEX_SECOLOR, seColor_form);


			//////////
			// Set default size and position
			//////
				SetRect(&carousel->rc, 0, 0, 320, 480);
				SetRect(&carousel->rco, 0, 0, 320, 480);
				SetRect(&carousel->rcp, 0, 0, 320, 480);

				// Set the size
				iObj_setSize(carousel, 0, 0, 320, 480);


			//////////
			// Default child settings
			//////
				SetRect(&lrc, 0, 0, bmpArrowUl->bi.biWidth, bmpArrowUl->bi.biHeight);
				llVisible	= propTitleBar(carousel);
				objChild	= carousel->firstChild;
				while (objChild)
				{
					// See which object this is
					if (objChild->objType == _OBJ_TYPE_IMAGE && propIsName_byText(objChild, cgcName_icon))
					{
						// Carousel icon
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP,			bmpCarouselIcon);
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP_DOWN,	bmpCarouselIcon);
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP_OVER,	bmpCarouselIcon);
						propSetBackStyle(objChild, _BACK_STYLE_TRANSPARENT);

						// Add highlighting for the over and down
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_OVER);			iBmp_colorize(bmp, &lrc, colorMouseOver, false, 0.25f);
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_DOWN);			iBmp_colorize(bmp, &lrc, colorMouseDown, false, 0.25f);
						propSetVisible_fromBool(objChild, llVisible);


					} else if (objChild->objType == _OBJ_TYPE_LABEL && propIsName_byText(objChild, cgcName_caption)) {
						// Caption
						propSetBackStyle(objChild, _BACK_STYLE_TRANSPARENT);
						propSetAlignment(objChild, _ALIGNMENT_MIDDLE_LEFT);
						propSetVisible_fromBool(objChild, llVisible);

						// Titlebar font
						iFont_delete(&objChild->p.font, true);
						objChild->p.font = iFont_create(cgcFontName_windowTitleBar, 10, FW_NORMAL, false, false);
						propSetCaption(carousel, cgcName_carouselCaption);


					} else if (objChild->objType == _OBJ_TYPE_IMAGE && propIsName_byText(objChild, cgcName_iconCarousel)) {
						// Carousel tabs icon
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP,			bmpCarouselTabsIcon);
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP_DOWN,	bmpCarouselTabsIcon);
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP_OVER,	bmpCarouselTabsIcon);
						propSetBackStyle(objChild, _BACK_STYLE_TRANSPARENT);

						// Add highlighting for the over and down
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_OVER);			iBmp_colorize(bmp, &lrc, colorMouseOver, false, 0.25f);
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_DOWN);			iBmp_colorize(bmp, &lrc, colorMouseDown, false, 0.25f);
						propSetVisible_fromBool(objChild, llVisible);


					} else if (objChild->objType == _OBJ_TYPE_IMAGE && propIsName_byText(objChild, cgcName_iconClose)) {
						// Close icon
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP,			bmpClose);
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP_DOWN,	bmpClose);
						iObjProp_set_bitmap_direct(objChild, _INDEX_PICTUREBMP_OVER,	bmpClose);
						propSetBackStyle(objChild, _BACK_STYLE_TRANSPARENT);

						// Add highlighting for the over and down
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_OVER);			iBmp_colorize(bmp, &lrc, colorMouseOver, false, 0.25f);
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_DOWN);			iBmp_colorize(bmp, &lrc, colorMouseDown, false, 0.25f);
						propSetVisible_fromBool(objChild, llVisible);
					}

					// Move to next object
					objChild = objChild->ll.nextObj;
				}

		}
	}
Exemplo n.º 7
0
	void iiSubobj_resetToDefaultSubform(SObject* subform, bool tlResetProperties, bool tlResetMethods, SObjPropMap* propList, u32 tnPropCount, SObjEventMap* eventList, u32 tnEventCount)
	{
		SObject*	objChild;
		SBitmap*	bmp;
		RECT		lrc;


		logfunc(__FUNCTION__);
		if (subform)
		{
			//////////
			// Reset the common settings
			//////
				iiObj_resetToDefaultCommon(subform, true, true, propList, tnPropCount, eventList, tnEventCount);


			//////////
			// Set default size and position
			//////
				SetRect(&subform->rc, 0, 0, 200, 100);
				SetRect(&subform->rco, 0, 0, 200, 100);
				SetRect(&subform->rcp, 0, 0, 200, 100);

				// Set the size of the child components
				iObj_setSize(subform, 0, 0, 200, 100);

				// Font
				iFont_delete(&subform->p.font, true);
				subform->p.font = iFont_duplicate(gsFontDefault);


			//////////
			// Set the defaults
			//////
				propSetAnchor(subform, _ANCHOR_FIXED_NORESIZE);
				propSetBackColor(subform, whiteColor);
				propSetBackStyle(subform, _BACK_STYLE_TRANSPARENT);
				propSetForeColor(subform, blackColor);
				propSetIcon(subform, bmpVjrIcon);
				propSetCaption(subform, cgcName_subform);


			//////////
			// Reset nw/ne/se/sw colors
			//////
				iObjProp_set_sbgra_direct(subform, _INDEX_NWCOLOR, nwColor_subform);
				iObjProp_set_sbgra_direct(subform, _INDEX_NECOLOR, neColor_subform);
				iObjProp_set_sbgra_direct(subform, _INDEX_SECOLOR, seColor_subform);
				iObjProp_set_sbgra_direct(subform, _INDEX_SWCOLOR, swColor_subform);


			//////////
			// Default child settings
			//////
				SetRect(&lrc, 0, 0, bmpArrowUl->bi.biWidth, bmpArrowUl->bi.biHeight);
				objChild = subform->firstChild;
				while (objChild)
				{
					// See which object this is
					if (objChild->objType == _OBJ_TYPE_IMAGE && propIsName_byText(objChild, cgcName_icon))
					{
						// Adjust the size
						iObj_setSize(objChild, objChild->rc.left, objChild->rc.top, bmpVjrIcon->bi.biWidth, bmpVjrIcon->bi.biHeight);

						// Form icon
						propSetPictureBmp(objChild, bmpVjrIcon);
						propSetPictureBmpDown(objChild, bmpVjrIcon);
						propSetPictureBmpOver(objChild, bmpVjrIcon);

						// Add highlighting for the over and down
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_OVER);			iBmp_colorize(bmp, &lrc, colorMouseOver, false, 0.5f);
						bmp = iObjProp_get_bitmap(objChild, _INDEX_PICTUREBMP_DOWN);			iBmp_colorize(bmp, &lrc, colorMouseDown, false, 0.5f);
						propSetBackStyle(objChild, _BACK_STYLE_TRANSPARENT);
						propSetVisible(objChild, _LOGICAL_TRUE);

					} else if (objChild->objType == _OBJ_TYPE_LABEL && propIsName_byText(objChild, cgcName_caption)) {
						// Caption
						iObjProp_set_character_direct(objChild, _INDEX_CAPTION, cgcName_formCaption, -1);
						iObjProp_set_s32_direct(objChild, _INDEX_BACKSTYLE, _BACK_STYLE_TRANSPARENT);
						iObjProp_set_sbgra_direct(objChild, _INDEX_FORECOLOR, whiteColor);
// 						iObjProp_set_sbgra_direct(objChild, _INDEX_FORECOLOR, blackColor);
						iObjProp_set_logical_direct(objChild, _INDEX_FONTBOLD, true);
						iFont_delete(&objChild->p.font, true);
//						objChild->p.font = iFont_create(cgcFontName_windowTitleBar, 10, FW_NORMAL, false, false);
						objChild->p.font = iFont_create(objChild);
						propSetVisible(objChild, _LOGICAL_TRUE);
					}

					// Move to next object
					objChild = objChild->ll.nextObj;
				}
		}
	}