Fundamental Notes/bada

bada : 스터디 2일차

콩콩댕 2010. 11. 16. 20:51
반응형
BasicApp 수정 완료.

C++  지역변수가 아닌, 외부에서도 접근가능하게 하려면 헤더 파일에 선언해준다.
#ifndef _ICONLISTFORM_H_
#define _ICONLISTFORM_H_

#include "BaseForm.h"
using namespace Osp::Graphics;

class IconListForm :
public BaseForm,
public Osp::Ui::IItemEventListener
{

public:
IconListForm(void);
virtual ~IconListForm(void);

bool Initialize(void);

protected:
Osp::Ui::Controls::IconList* __pIconList;
Osp::Ui::Controls::Label* __pLabelLog;
Bitmap *pNormalBitmap1;
Bitmap *pNormalBitmap2;


public:
virtual result OnInitializing(void);
virtual void OnItemStateChanged(const Osp::Ui::Control& source, int index, int itemId, Osp::Ui::ItemStatus status);
};

#endif
생성자에서 초기화 해준다.
IconListForm::IconListForm(void) :
__pIconList(null),
__pLabelLog(null)
{
Image *pImage = new Image();
pImage->Construct();
pNormalBitmap1 = pImage->DecodeN(L"/Res/nemo.png", BITMAP_PIXEL_FORMAT_ARGB8888);
pNormalBitmap2 = pImage->DecodeN(L"/Res/nemopush.png", BITMAP_PIXEL_FORMAT_ARGB8888);
}


bada App 실행과정

앱에 필요한 라이브러리를 로드하고 앱의 실행파일(바이너리 파일)을 메모리에 로드한다. 그리고 앱의 진입점(entry point)에 해당하는 OspMain()함수가 실행되는데, 이 함수가 실행되고 나면 그때 비로소 OnAppInitializing()함수가 실행되어 실제 앱의 초기화를 진행한다. 이 초기화 과정에는 여러 가지 리소스의 초기화뿐만이 아니라 UI컴포넌트의 초기화도 포함되며, 때에 따라서는 이전에 실행되었던 상태로의 복원까지 포함되기도 한다. 예를 들어 'testApp'이라는 앱을 만든다면, OnAppInitializing()함수는 다음과 같이 testApp.cpp 파일에 존재한다. 프로그램이 실행되면 OspMain()->testApp::CreateInstance()->testApp constructor->Oninitializing()순서로 호출된다.

1. testEntry.cpp - OspMain()
2. test.cpp - test::CreateInstance()
3. test.cpp - testApp constructor
4. Form1.cpp - Form1::OnInitializing()
5. Form1.cpp - Form1::OnActionPerfomed()

*IconListForm을 이용하여 네모네모로직 UI 연습

*네모네모 로직만들때, 아이콘리스트활용. 아이템 크기 디폴트에서 수정하는 방법
result Osp::Ui::Controls::IconList::Construct ( const Osp::Graphics::Rectangle &  rect,
IconListStyle  style,
int  itemWidth,
int  itemHeight  
)

Initializes this instance of IconList with the specified parameters.

Returns:
An error code
Parameters:
[in]  rect  An instance of the Graphics::Rectangle class 
This instance represents the X, Y coordinates of the left top corner of the createdIconList along with the width and height. 
[in]  style  The style set of IconList
[in]  itemWidth  The width of items in the IconList
[in]  itemHeight  The height of items in the IconList
Exceptions:
E_SUCCESS  The method was successful.
E_INVALID_STATE  This instance has already been constructed.
E_OUT_OF_MEMORY  Insufficient memory.
E_SYSTEM  A system error occurred.
Remarks:
A control is fully usable only after it has been added to a container, therefore some methods may fail if used earlier. 

*로그남기는 방법
AppLog("text");

'Fundamental Notes > bada' 카테고리의 다른 글

bada : UI & Graphics  (0) 2010.11.28
bada : Application  (0) 2010.11.28
bada : Fundamentals  (0) 2010.11.28
bada : Development Environment  (0) 2010.11.28
bada : Application Life-cycle  (0) 2010.11.28